Find minimum values based on unique number
5 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Mathieu NOE
2024-5-15
hello
the provided mat file contains 492 different profiles (and not 147)
my suggestion so far :
load('matlab.mat')
prof = Prof_temp.Profile_num;
prof_unic = unique(prof);
for k=1:length(prof_unic)
ind = (prof == prof_unic(k));
T_min(k) = min(Prof_temp.Temp(ind),[],'omitnan');
end
plot(prof_unic,T_min);
xlabel('Profile #')
ylabel('Average temperature')
10 个评论
更多回答(1 个)
Stephen23
2024-5-15
P = load('matlab.mat').Prof_temp
S = groupsummary(P,"Profile_num","min","Temp")
plot(S.Profile_num,S.min_Temp)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!