loop in a column to calculate max and min in a certain interval
Show older comments
i have a column that has 200 values of length for each volume. and there can be n no. of volumes. so i need to calculate the maximum and minimum of lengths for each volume and plot volume(vs)minlength and volume(vs)maxlength in the same plot. please suggest a loop and how to apply it. help is much appreciated.
2 Comments
jonas
on 28 May 2018
What do you mean by volume? Can you provide an example? The problem is not clear to me.
hi! i will attach a file. so its 1st column is volume and 16th column is length.
Answers (2)
jonas
on 28 May 2018
Perhaps this will help...
data=readtable('ROSETTE_S2_R5_GeometricData.csv');
[volumes]=unique(data{:,1});
out=nan(2,length(volumes));
for i=1:length(volumes);
out(1,i)=min(data{data{:,1}==volumes(i),16});
out(2,i)=max(data{data{:,1}==volumes(i),16});
end
figure;
plot(volumes,out(1,:),...
volumes,out(2,:));
9 Comments
sud
on 28 May 2018
jonas
on 28 May 2018
Please select the text before clicking code
sud
on 28 May 2018
sud
on 28 May 2018
sud
on 28 May 2018
sud
on 28 May 2018
jonas
on 28 May 2018
Sorry but I can't help you if you don't format your code correctly. I mean, you can see it yourself after posting. Try pasting the format you gave me into MATLAB and run it...
sud
on 28 May 2018
jonas
on 28 May 2018
I did some formatting and wrote this for you (see attached). All values are stored in maximum and minimum. You can choose which curve to plot by changing the variable id.
If you need anything else, please format the post correctly.
Categories
Find more on Correlation and Convolution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
