numeric values need to be equalize to symbolic values.

1 view (last 30 days)
distances=[100 120;200 220]
points_id=[{'p1'} {'p2'};{'p3'} {'p4'}]
% I need to equalize each matrixes to each other.
%for example, 100='p1' , 120='p2' , 200='p3' , 220='p4'
%then, when I need to learn the numeric values symbol, for example, 220, I could be retrive 'p4' as a symbolic assigned value of 220.

Accepted Answer

Star Strider
Star Strider on 7 May 2014
Here are two functions, the first will find point_id given an element of the distances matrix:
pointfind = @(d) points_id(find(distances == d));
so
p = pointfind(220)
returns
p =
'p4'
and the second one will find the corresponding element in distances given an element in the point_id array:
distfind = @(p) distances(find(cellfun(@isempty, strfind(points_id, p)) == 0));
so
d = distfind('p4')
returns
d =
220

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!