How to collect it by using loop
1 次查看(过去 30 天)
显示 更早的评论
In response of statement
[J,K] = find(Image);
I have got J and K of size [14,1]
Now I want to locate
R1 = [J(1), K(1)]
R2 = [J(2), K(2)] and so on till R14 = [J(14), K(14)]
How to complete this task using loop?
2 个评论
Stephen23
2018-12-4
You tagged this question with "changing variable name for each iteration", but it is important to learn that magically changing variable names is one way that beginners force themselves into writing slow, complex, buggy code that is hard to debug. Read this to know why:
The MATLAB documentation and all experienced MATLAB users reccomend using indexing. Indexing is neat, simple, very efficient, and easy to debug. Unlike what you are trying to do.
采纳的回答
madhan ravi
2018-12-4
Don't name the variable dynamically use cell instead
R=cell(1,14); % preallocation
for i=1:14
R{i}=find(image);
end
celldisp(R)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!