필터 지우기
필터 지우기

how to use MATLAB units ?

조회 수: 3 (최근 30일)
timo
timo 2016년 3월 10일
편집: Karan Gill 2017년 10월 17일
I need to use units in Matlab
To use Matlab units i use Mupad like this:
aux1 = evalin(symengine,'unit::convert(2.1*unit::volt, unit::mvolt)')
Which returns
2100.0*unit::mvolt
Is there any way to use units beside this hack , which is quite annoying ...

채택된 답변

Karan Gill
Karan Gill 2017년 3월 10일
편집: Karan Gill 2017년 10월 17일
Starting R2017a, units are available in MATLAB via Symbolic Math Toolbox. See:
Karan. (Symbolic doc)
[SL: fixed typo.]

추가 답변 (2개)

Walter Roberson
Walter Roberson 2016년 3월 10일
Other than switching to feval() syntax, No.
  댓글 수: 5
timo
timo 2016년 3월 14일
편집: timo 2016년 3월 14일
Anyway sym syntax is fine by me
I marked my answer as the solution.
Walter Roberson
Walter Roberson 2016년 3월 15일
aux1 = feval(symengine, 'unit::convert', 2.1 * V, mV)

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


timo
timo 2016년 3월 13일
편집: timo 2016년 3월 14일
Well to reduce some extratyping this shall help :)
MUPAD = @(x) sym(x);
Then use like MUPAD('unit::ohm')
The better solution is thanx to Walter's suggestion is to use sym keyword and then the string for Mupad units. I will see how it gets me

카테고리

Help CenterFile Exchange에서 Utilities for the Solver에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by