How to run multiple iterations while increasing the index?

I'm new to Matlab and I am trying to create a for loop.
I am trying to run the second line on each index in the array of imdata. How can I write a for loop where the index continuously increases but saves each result into a csv/table?
Below is what I have so far. Thank you for your help!
imdata(2).perforder
[N, edges] = histcounts(x)

 채택된 답변

Rik
Rik 2020년 8월 24일
편집: Rik 2020년 8월 24일
The easiest way to do this is to standardize the bins. If you don't want that, you should probably use a cell array.
for n=1:numel(imdata)
x=imdata(n).perforder;
[N{n}, edges{n}] = histcounts(x);
end

댓글 수: 2

Thank you! I just figured that part out, but I am still having trouble putting the 'N' strings into a csv file. Do you know how to do that?
It isn't a string, it is a vector. What format would you like to have? Just the numbers with a comma in between?

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2020년 8월 24일

댓글:

Rik
2020년 8월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by