How can i display a vector as a result of a for loop ?

1 view (last 30 days)
I have thi loop for and i want to display the mmk but i can't for rload=0:20:50000 v = -x(:,3)*rload; mn =(max(v)-min(v))/2 mk=mn'; end

Accepted Answer

Image Analyst
Image Analyst on 5 May 2016
Index the variables and leave off the semicolon
for rload=0:20:50000
v = -x(:,3)*rload;
mn =(max(v)-min(v))/2 % A single number.
mk(rload) = mn
end
  3 Comments
Image Analyst
Image Analyst on 5 May 2016
The index can't be zero. Use a counter index that starts at 1.
index = 1;
for rload=0:20:50000
v = -x(:,3)*rload;
mn =(max(v)-min(v))/2 % A single number.
mk(index) = mn
index = index + 1;
end

Sign in to comment.

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 5 May 2016
mk=mn';
remove the semi colon
mk=mn'

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!