Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

How to Update matrix values

Asked by Arun Badigannavar on 2 Jan 2013

I have a matrix[2 2:2 2]I want to update these four values one by one ie[3 3:3 3],[4 4:4 4],[5 5:5 5] like thgis I want to update ,,,how can i achieve this with script?

0 Comments

Arun Badigannavar

Products

No products are associated with this question.

2 Answers

Answer by Sriram on 2 Jan 2013
Accepted answer
b = {};
a=[1 2;3 4]
for i=1:1:100;
  a=a+1;
  b = [b a];
end

1 Comment

Arun Badigannavar on 2 Jan 2013

exactly what i wanted

Sriram
Answer by Walter Roberson on 2 Jan 2013
A = A + 1;

4 Comments

Arun Badigannavar on 2 Jan 2013
a=[1 2;3 4]
for i=1:1:100;
    a=a+1
end
Here I want to see the a values for each step of i,,,which is saved in the array of a(i)
Walter Roberson on 2 Jan 2013

If you want to see each updated value, you could remove the semi-colon from the addition

a(i) = a(i) + 1   %no semi-colon
Arun Badigannavar on 2 Jan 2013

ya i know this ,,but i want to save the value of a(i) from i =1 to i=100

Walter Roberson

Contact us