필터 지우기
필터 지우기

How to display the loop number as a value in an array?

조회 수: 2 (최근 30일)
Jasmine Karim
Jasmine Karim 2018년 7월 30일
댓글: Jasmine Karim 2018년 7월 30일
I have a loop that is accessing data from one array and creating another array of about 500 rows x 4 columns. I want one of those columns to have the value of the LOOP NUMBER (which is not always the same as the ROW number in the new array). disp gives me the correct value, but how can I hold that value and put it into a column?

채택된 답변

Adam Danz
Adam Danz 2018년 7월 30일
Is there a problem with storing the loop variable like this in column 1?
for i = 1:100
data(i,1) = i;
end
  댓글 수: 3
Adam Danz
Adam Danz 2018년 7월 30일
Change the parentheses in data(i,1) to curly brackets and see if that solves your issues. data{i,1}
Jasmine Karim
Jasmine Karim 2018년 7월 30일
Thank you

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by