How to run completely a loop inside one other?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi! i have the data attached. ID_stop1 is an identifier of data and it is repeated 80 times for each value. Nn1 is a number from 1 to 20 and it is still repeated for each unique value of ID_stop1. Bn1 is a number from 1 to 20 and it is repeated for each unique value of Nn1. I need to access to data of L1 for each ID_stop1 and each Nn1. I created this code that works but at the end of the second loop it stops. How can i come back to the first loop?
I would like to have a cell array of 20 cells, and for each cell there should be 20 sub cells.
Any helps?
load ('sclerometrica_equotip_v1')
misure = [ID_stop L Nn Bn];
% misure(any(isnan(misure), 2), :) = [];
ID_stop1 = misure(:,1);
L1 = misure(:,2);
Nn1 = misure(:,3);
Bn1 = misure(:,4);
k = unique(ID_stop1);
for i = 1:numel(k)
index = (ID_stop1 == k(i));
N= Nn1(index); %battute nodi
j = unique(N);
for m = 1:numel(j)
index2 = (N == j(m));
L_nodo = L1(index2);
result{m} = L_nodo;
end
end
0 件のコメント
採用された回答
Bob Thompson
2019 年 3 月 6 日
I suspect that the issue is not that the code actually stops, but that the results are only recorded for one internal loop. If you want cells inside of cells then you need to index for each loop.
results{i}{m} = L_nodo;
10 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!