展开全部
data = Table[x y, {x, 1, 10}, {y, 1, 10}] // MatrixForm
i = 5;
j = 3;
subtract = ReplacePart[data, {1, a_, i} -> f[a]];
f[a_] := data[[1, a, i]] - data[[1, a, j]];
subtract
Clear[f];
计算结果是Table内第i列元素减去第j列元素,相减的结果替换原来Table内第i列元素
更简单的:
data = Table[x y, {x, 1, 10}, {y, 1, 10}];
i = 2;
j = 8;
subtract =
Transpose[
ReplacePart[
Transpose[data], {i} ->
Transpose[data][[i]] - Transpose[data][[j]]]] // MatrixForm
i = 5;
j = 3;
subtract = ReplacePart[data, {1, a_, i} -> f[a]];
f[a_] := data[[1, a, i]] - data[[1, a, j]];
subtract
Clear[f];
计算结果是Table内第i列元素减去第j列元素,相减的结果替换原来Table内第i列元素
更简单的:
data = Table[x y, {x, 1, 10}, {y, 1, 10}];
i = 2;
j = 8;
subtract =
Transpose[
ReplacePart[
Transpose[data], {i} ->
Transpose[data][[i]] - Transpose[data][[j]]]] // MatrixForm
2014-05-04
展开全部
Transpose[table][[i]]-Transpose[table][[j]]
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询