Subscripting into an mxArray is not supported.

조회 수: 3 (최근 30일)
hanaa
hanaa 2014년 6월 22일
댓글: Sriharsha 2015년 3월 13일
part of code is:
function m = func_Dec(in)
m = zeros(in(1,1));
n_max = in(1,2);
level = in(1,3);
but errors occur at
Subscripting into an mxArray is not supported.
Function 'func_Dec.m' (#29.405.412), line 16, column 11:
"in(1,1)"
  댓글 수: 1
Sriharsha
Sriharsha 2015년 3월 13일
I got an ERROR , while running a function inside the Simulink
""Subscripting into an mxArray is not supported.""
function y = PY_MAT(r,t,v,rcs)
coder.extrinsic('tic','toc', 'system','clear'
,'clc','num2str','str2double','strsplit','cell2mat','str2num',... 'ceil','cellstr','floor','repmat','numel');
tic
% commandStr = ['C:\LegacyApp\Python27\python PY_MAT.py ',num2str(a),'
',num2str(b),' ',num2str(c),' ',num2str(d)];
commandStr = ['C:\LegacyApp\Python27\python
D:\CM_Projects\TaccTest_FreeSpaceDynamicObjects_100315_New\src_cm4sl\run_ref.py
'... ,num2str(r'),' ',num2str(t'),' ',num2str(v'),' ',num2str(rcs')];
[status, commandOut] = system(commandStr)
y = 0;
% y = zeros(size(commandOut), class(r));
y = commandOut;
K=strsplit(y,'..');
A = cell2mat(K(1));
y = str2num(A);
toc
end

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

채택된 답변

Ryan Livingston
Ryan Livingston 2014년 6월 24일
It appears that you are using an extrinsic function (declared with coder.extrinsic) to create in, correct? In that case you need to first assign a value to in before making the extrinsic call to tell the code generation software what type to expect.
For example, suppose that the function foo returns a 3-by-4 array of real doubles. Then you would use code like:
coder.extrinsic('foo');
x = zeros(3,4);
x = foo(y);
You can see my answer:
for more information.
  댓글 수: 6
hanaa
hanaa 2014년 7월 4일
I want to thank you for your help, and i wonder if that possible to help me more about some errors that i tried to correct some of them but others i can't correct. attached image of related errors.
<<
>>
hanaa
hanaa 2014년 7월 4일

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

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 6월 23일
What are you trying to do? Zeros creates an array of zeros and you need to pass in the size of the array you want to create. Is in(1,1) that size? If so, it MUST be integer value and in that case, it will create a square array of zeros and pass it back. The other two lines don't do anything useful either.
How are you creating the array "in" in your main (calling) routine, and how are you calling func_Dec()?

카테고리

Help CenterFile Exchange에서 Raspberry Pi Hardware에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by