How to add iteration in a string (make multiple strings using iterations without indexing) ?
이전 댓글 표시
I have been wondering for a loooong time how to acheive this. (I am a beginner by the way so please bear with me)
The problem is shown in the sample code below. I want the numerical "i" to be used in the string to output: "png1", "png2", and so forth.
Of course the code doesn't work.
I know of a way; to make a matrix in advance with string then access the matrix but this won't work with a while loop.
I thank you so much in advance.
for i = 1:4
matlab = "png(i)"
end
채택된 답변
추가 답변 (1개)
Image Analyst
2021년 10월 25일
1 개 추천
If I understand you correctly you want to dynamically/programmatically create named variables and then access them later by that created name. The reasons against this are discussed in the FAQ:
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!