How can I evaluate an in a MATLAB script

조회 수: 4 (최근 30일)
Karsten Gordon
Karsten Gordon 2022년 9월 15일
댓글: checker 2023년 10월 3일
Hi all,
In my data dictionary, I have a Simulink.Parameter whose value is set as an expression:
Parameter with properties:
Value: slexpr("single(420*pi/180)")
CoderInfo: [1×1 Simulink.CoderInfo]
Description: '...'
DataType: 'single'
Min: 0
Max: 20
Unit: 'rad'
Complexity: 'real'
Dimensions: [1 1]
Now I would like to get the numeric value of the parameter within a script. So how can I evaluate the expression
to get
ans =
Any hint would be greatly appreciated. Thank you very much.
  댓글 수: 1
checker 2023년 10월 3일
Assuming you have a variable set equal to the expression
parmVal = slexpr("single(420*pi/180")
it will be of class type ''
The value can be determined by the following

댓글을 달려면 로그인하십시오.

답변 (1개)

Jeffrey Clark
Jeffrey Clark 2022년 9월 15일
@Karsten Gordon, Evaluate MATLAB expression in data dictionary section - MATLAB evalin ( or Evaluate MATLAB expression - MATLAB eval ( I don't have Simulink to try; to use the eval function you would have to use just what is in the quotes:"single(420*pi/180)"


Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기





Community Treasure Hunt

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

Start Hunting!

Translated by