Find minimum values based on unique number
Mostra commenti meno recenti
I have a dataset of temperatures collected over multiple depth profiles (1-147 profiles). The data is all listed in one long table, not by each profile (attached).
Each profile has a different temperature minimum, and I want to find this minimum for each profile, and colour all of the temperatures above this in grey in a figure (essentially discarding them).
- Evidently I'm going about this the wrong way as my output (T_min) is all the same number (see code below).
- Once I have the T_min for each profile, when I do a scatter plot, how can I colour each dot less than the T_min - for that particular profile - grey?
Thanks in advance - sorry if this isn't very clear.
j=1;
for i=1:length(dives)
T_min(j) = nanmin(SG579_FINAL_table_MF.Cons_temp(dives));
j=j+1;
end
Risposta accettata
Più risposte (1)
P = load('matlab.mat').Prof_temp
S = groupsummary(P,"Profile_num","min","Temp")
plot(S.Profile_num,S.min_Temp)
4 Commenti
DD_2023
il 15 Mag 2024
" colour the points where the points less than the T min for that associated profile number are coloured differently."
I guess you mean where the S-values are less thatn T-min (because of course no Temp values should be less than T-min.
P = load('matlab.mat').Prof_temp
S = randn(size(P.Temp))
V = grouptransform(P.Temp,P.Profile_num,@min);
X = S<V;
scatter(S(X),P.Temp(X),23,[1,1,1]./2)
hold on
scatter(S(~X),P.Temp(~X),23)
xlabel('S')
ylabel('Temp')
DD_2023
il 15 Mag 2024
DD_2023
il 15 Mag 2024
Categorie
Scopri di più su Graphics Performance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




