Why 'for loop' is very slow even working on server
Ältere Kommentare anzeigen
My 'for loop' looks like
iwant = cell(a,b);
for i =1:17
c = data(:,:,i);
for j = 1:b
idx = inpolygon(X(:),Y(:),S(j).X , S(j).Y);
iwant{i,j} = c(idx);
end
end
Where a =17,c = 420*940, X = 420*940, Y = 420*940 and b = 1*1 which is polygon and its size is (shape_area 56.4087, x= 1*679340, y = 1*679340).
This for loop is taking very long time even days, so how could I execute it in minimum time
Thank you in advance for any kind of help
1 Kommentar
madhan ravi
am 20 Okt. 2018
size(iwant)?
Akzeptierte Antwort
Weitere Antworten (1)
Bruno Luong
am 20 Okt. 2018
0 Stimmen
As I mention in another thread you can get on FEX that can be 100 times faster than MATLAB inpolygon, let alone the newy polyshape
7 Kommentare
Shakir Hussain
am 22 Okt. 2018
Bruno Luong
am 22 Okt. 2018
Please describe your data type with small example, MATLAB code (and optionally real data you are working on), not a screen capture that isn't helpful.
Shakir Hussain
am 25 Okt. 2018
Bearbeitet: Shakir Hussain
am 25 Okt. 2018
Walter Roberson
am 25 Okt. 2018
test{1,6} has 10 elements. test{1,7} has 4 elements. What do those elements mean ?
The data you uploaded is a cell of 17 x 3038; you have previously spoken of a cell 17 x 3075.
What size of output are you looking for? How do you want it to be calculated from the 17 x 3038 cell ?
Shakir Hussain
am 25 Okt. 2018
Bearbeitet: Shakir Hussain
am 25 Okt. 2018
Walter Roberson
am 25 Okt. 2018
tt = cell2mat(cellfun(@transpose,test,'uniform',0));
Shakir Hussain
am 26 Okt. 2018
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!