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

조회 수: 1 (최근 30일)
Mallouli Marwa
Mallouli Marwa 2016년 5월 5일
댓글: Mallouli Marwa 2016년 5월 6일
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

채택된 답변

Image Analyst
Image Analyst 2016년 5월 5일
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
Image Analyst
Image Analyst 2016년 5월 5일
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

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 5월 5일
mk=mn';
remove the semi colon
mk=mn'
  댓글 수: 1
Mallouli Marwa
Mallouli Marwa 2016년 5월 5일
this loop for allow me to obtain the last value of mk. This is my problem

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by