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

1 Ansicht (letzte 30 Tage)
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

Akzeptierte Antwort

Image Analyst
Image Analyst am 5 Mai 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 Kommentare
Image Analyst
Image Analyst am 5 Mai 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 5 Mai 2016
mk=mn';
remove the semi colon
mk=mn'
  1 Kommentar
Mallouli Marwa
Mallouli Marwa am 5 Mai 2016
this loop for allow me to obtain the last value of mk. This is my problem

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by