フィルターのクリア

Find minimum values based on unique number

3 ビュー (過去 30 日間)
DD_2023
DD_2023 2024 年 5 月 15 日
コメント済み: Mathieu NOE 2024 年 5 月 15 日
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).
  1. Evidently I'm going about this the wrong way as my output (T_min) is all the same number (see code below).
  2. 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

採用された回答

Mathieu NOE
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 件のコメント
DD_2023
DD_2023 2024 年 5 月 15 日
Thank you! This looks more like what I was expecting. Apologies for my lack of clarity :)
Mathieu NOE
Mathieu NOE 2024 年 5 月 15 日
ok - glad we finally converged to the solution !! :)

サインインしてコメントする。

その他の回答 (1 件)

Stephen23
Stephen23 2024 年 5 月 15 日
P = load('matlab.mat').Prof_temp
P = 460116x2 table
Profile_num Temp ___________ _______ 1 0.73595 1 0.73338 2 0.73372 2 0.72239 2 0.73413 2 0.7322 2 0.73786 2 0.73755 2 0.73594 2 0.74415 2 0.7336 2 0.72792 2 0.74704 2 0.75886 2 0.75926 2 0.7642
S = groupsummary(P,"Profile_num","min","Temp")
S = 492x3 table
Profile_num GroupCount min_Temp ___________ __________ __________ 1 2 0.73338 2 144 0.65173 3 2 0.73312 4 144 0.69801 5 239 0.36951 6 78 0.35654 7 79 0.70014 8 160 0.66216 9 156 0.013414 10 205 0.013662 11 442 0.00084435 12 626 0.028878 13 705 0.025135 14 959 0.015209 15 683 0.026312 16 915 -0.058026
plot(S.Profile_num,S.min_Temp)
  4 件のコメント
DD_2023
DD_2023 2024 年 5 月 15 日
Sorry you make an excellent point and have made me realise I've completely messed up my explanation.
T_min for each profile will be located at a certain depth (called Pres, and the T_min Pres will differ between profiles). In the scatter plot of T and S, I wanted to colour any dots shallower than the T_min Pres (differing between profiles) grey.
DD_2023
DD_2023 2024 年 5 月 15 日
Here are the data for Pres and S

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by