Matlab coder and exponentiation

조회 수: 1 (최근 30일)
David Short
David Short 2015년 3월 27일
댓글: David Short 2015년 3월 30일
I'm sure there is a way to get matlab coder to do A = B ^ C where all A, B and C are scalers, but for the life of me, I'm just not seeing it.
Every way I try and express it ends up with the error "Matrix power is not supported for code generation."
A = B(1) .^ C(1) isn't getting me where I want to go.
I can do it in C. I can do it in Matlab, I just can't get Matlab to do it in C.
  댓글 수: 2
Konstantinos Sofos
Konstantinos Sofos 2015년 3월 27일
A,B and C are matrices or scalars...i cannot understand the "scalers" that you wrote?
Rick Rosson
Rick Rosson 2015년 3월 27일
Konstantinos, don't you think it's just a typo?

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

채택된 답변

Ryan Livingston
Ryan Livingston 2015년 3월 28일
This sounds like an installation issue. Can you check to see that the files:
fullfile(matlabroot,'toolbox','eml','lib','matlab','ops','mpower.m')
fullfile(matlabroot,'toolbox','eml','lib','matlab','ops','power.m')
exist in your MATLAB installation? Likely they do not as ^ should be supported for code generation.
If they are not present, reinstalling would be advised. Customer support should be able to help you get going again if the install doesn't seem to be successful.
If the files are present, try to run
restoredefaultpath
rehash toolboxcache
and see if codegen succeeds.
  댓글 수: 1
David Short
David Short 2015년 3월 30일
On a different machine a test case works with 2014b. Same test case is not working on my original machine with 2014a.
Either version or installation. Comment on this Answer David Short

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

추가 답변 (1개)

James Tursa
James Tursa 2015년 3월 27일
Have you tried A = exp( C * log(B) ) ?
  댓글 수: 1
David Short
David Short 2015년 3월 30일
As a work around this works. Thank you. I'm still interested in pursuing what the underlying cause is with not being able to use mpower from matlabcoder.
Thanks James!

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by