extracting data by min and loop
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have the topography data in which I introduced X, Y, Z as follows. X and Y is the coordinate and Z is the elevation. I want to extract the min Z for each raw and their X and Y. Since I want to have the min elevation graph based on the distance, I need to calculate [delta(X)^2 + delta(Y)^2] for the Z which are not in the same column. Here is the code which I write, but it doesnt work the way I want!! any idea?
X=[25 26 28];
Y=[50 51 55];
Z = [345 386 312;607 615 630;995 901 956];
nrX=length(X);
nrY=length(Y);
if nrX > nrY;
nrT=nrX;
else
nrT=nrY;
end
[R,I]=min(Z,[],2);
X2=X(I);
Y;
for i=1:nrX-1
for j=1:nrY-1
for k=1:nrT-1
T(k)= ((X2(i+1)-X2(i))^2+(Y(j+1)-Y(j))^2)^0.5
end
end
end
R
T
0 Commenti
Risposte (1)
Azzi Abdelmalek
il 21 Ago 2016
Z = [345 386 312;607 615 630;995 901 956]
min_val,index=min(Z,[],2)
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!