Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to add with a Matrix

2 次查看(过去 30 天)
John Woods
John Woods 2020-6-19
关闭: MATLAB Answer Bot 2021-8-20
I have a 1x276 matrix that I want to add 1 to each element but each time I do, my matrix turns to all ones. So for example lets say A=[32 45 96] and I want to make it B=[33 46 97] how do I do that?

回答(1 个)

Walter Roberson
Walter Roberson 2020-6-19
编辑:Walter Roberson 2020-6-19
B = A + 1
or
B = A;
for idx = 1 : numel(B)
B(idx) = B(idx) + 1;
end

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by