numeric values need to be equalize to symbolic values.

1 回表示 (過去 30 日間)
sermet
sermet 2014 年 5 月 7 日
回答済み: Star Strider 2014 年 5 月 7 日
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 Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by