Invalid use of -. At least one of the operands must be scalar or the operands must be the same size. The units of the operands must be commensurate.

조회 수: 35 (최근 30일)
Invalid use of -. At least one of the operands must be scalar or the operands must be the same size. The units of the operands must be commensurate. In ee.semiconductors.n_mosfet
Argument 1 = {[1x1 double],'K'}
Argument 2 = {25,'C'}
T = {[1x1 double],'K'}
Tmeas = {25,'C'}
Warning: Unit'C' for parameter'Measurement temperature: Unit' specified in the block is not commensurate with the default unit'degC' specified in the library. Please specify a unit commensurate with'degC' for parameter'Measurement temperature: Unit'.
Warning: Unit'C
  댓글 수: 2
Crystal Blackwell
Crystal Blackwell 2021년 3월 25일
Ironically, I am working on a temperature based experiment as well. I am not sure if you are trying to create a custom component as myself.
I used a work around. The value function allows you to extract the scalar from variables with units. Then I performed the math using the scalar and reassigned the units afterwards using a T = { result of calc, reassigned unit} statement. I know in Temperature experiments, change in K = change in degrees C. So if that is your issue then this might help you out.
Crystal Blackwell
Crystal Blackwell 2021년 3월 26일
Of course the other option is to remove your units from unnecessary places.

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

답변 (1개)

Sindar
Sindar 2020년 10월 13일
Wherever you specify the units as 'C', put 'degC' instead
  댓글 수: 1
Waseem Haider
Waseem Haider 2020년 10월 15일
Thanks for your kind response but i already tried it. now i got this error.
Unit expression C is not commensurate with degC. please provide a commensurate unit expression.

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by