numeric values need to be equalize to symbolic values.

1 次查看(过去 30 天)
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.

采纳的回答

Star Strider
Star Strider 2014-5-7
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by