Searching through table using compound condition

2 views (last 30 days)
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.

Answers (1)

Roger Breton
Roger Breton on 15 Mar 2022
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...

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!