MATLAB Answers

How can I get the column number of a matrix with smallest error to my value?

2 views (last 30 days)
Lukas Nuschele
Lukas Nuschele on 12 Jan 2020
Answered: Stijn Haenen on 12 Jan 2020
The code below finds values("Tempvalue") out of a predefined RGB Scale ("RGB"), output "x" shall be the number of the row this value occurs.
How can I find the value of a Matrix "Tempvalue=100x3" within a "RGB=875x3" Matrix with the smallest error if an exact value doesn´t exist in this matrix?
Output x should be the column number of RGB where the value with the smallest error occurs.
Thanks for you help, if any questions feel free to ask :)
Greetings Lukas
for i=1:100
x=find(ismember(RGB,Tempvalue,'rows'));%will give you the column numbers of RGB that match Tempvalue
if x~=0
else % x should be the column number of RGB with smallest error to Tempvalue


Sign in to comment.

Answers (1)

Sign in to answer this question.