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 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