I am trying to store matrices produced in a for loop before it get overwritten by the next iteration. The problem is the matrix size is that of an image while my loop limits is just from 1 to 9. What should I do knowing that I cannot use the cell command and put it in the loop limit?

댓글 수: 2

Azzi Abdelmalek
Azzi Abdelmalek 2016년 6월 3일
Show us your code
M
M 2016년 6월 3일
편집: per isakson 2016년 6월 3일
for k=1:9
I=sprintf('',k)
J=imread(I)
end

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

 채택된 답변

Geoff Hayes
Geoff Hayes 2016년 6월 3일

0 개 추천

M - why can't you use a cell array to store the images?
myImages = cell(9,1);
for k=1:9
I=sprintf('',k); % is this supposed to be the name of a file? what is the extension?
J=imread(I);
myImages{k} = J;
end
You seem to be missing the file extension for your image though...

댓글 수: 1

M
M 2016년 6월 3일
I think my error was in the type of brackets. Thank you very much.

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

추가 답변 (0개)

카테고리

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

태그

질문:

M
M
2016년 6월 3일

댓글:

M
M
2016년 6월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by