Searching through table using compound condition

1 回表示 (過去 30 日間)
Roger Breton
Roger Breton 2022 年 3 月 15 日
回答済み: Roger Breton 2022 年 3 月 15 日
I would leke to add a Munsell Notation readout capability to my script. Right now, when the student clicks a point in scatter3 graph, a custom data tip is used to report CIE Colorimetry :
This is great but I would like to add the corresponding Munsell Notation, somewhere in the figure. I tried to add it to my custom data tip function to no avail. So I accepted to display it, somewhere at the bottom right, through a text uicontrol in response to the "Plot2D" pushbutton uicontrol being pressed. Not ideal but it will work.
In order to do this, I'm using this code :
C = readcell('Munsell/1 - 2.5 BG_2.csv');
T = cell2table(C, "VariableNames",["Notation" "CIE_L" "CIE_a" "CIE_b"])
target = 51.71;
table2 = T(T.CIE_L == target,:);
You see, when the student selects a point in 3D space, it's possible that its CIE L* value would be unique in the file. But it's also possible that the value would not be unique, and in this case, my little search trick would be defeated? So I'm thinking, is there a way I could use a set of conditions in the selection statement above, such as :
C = readcell('Munsell/1 - 2.5 BG_2.csv');
T = cell2table(C, "VariableNames",["Notation" "CIE_L" "CIE_a" "CIE_b"])
target_L = 51.71;
target_a = -43.15;
target_b = -1.43;
table2 = T(T.CIE_L == target_L & T.CIE_a == target_a & T.CIE_b == target_b ,:);
Would this be acceptable? The search files are relatively small.

回答 (1 件)

Roger Breton
Roger Breton 2022 年 3 月 15 日
It worked! Sorry for the newbie question. I'm sure there are far more elegant ways to do search a table for information... Will see how far I can get on this code -- thank you for your kind attention.
I'm bound to have follow-up questions...

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by