필터 지우기
필터 지우기

Modify colobar values into a Function: error "Attempt to extract field 'YTick' from 'mxArray'"

조회 수: 2 (최근 30일)
Hi,
into a Matlab Function in Simulink environment I want to modify the value shown by a colorbar (adding min and max values at the two ends of the colorbar).
Therefore in the Function there is the following code:
cbar=colorbar;
colorbar('Ticks',[ MyMinVal, cbar.Ticks, MyMaxVal ],'TickLabels',[ MyMinVal, cbar.Ticks, MyMaxVal ]);
The above command works if I execute it from command window, but during the simulink simulation does not work, and I get the following error:
Attempt to extract field 'YTick' from 'mxArray'.
Probably there is something related to the "coder.extrinsic" to set at the beginning of the routine but I don't know exactly what.
Thanks and best regards, A

채택된 답변

Alberto Mora
Alberto Mora 2020년 6월 5일
Partially solved. Instead of call the colorbar and then modify it, I do it toghedar as follow:
colorbar('Ticks',ValForColorbar,'TickLabels',ValForColorbar);

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by