Subscripting into an mxArray is not supported.
조회 수: 3 (최근 30일)
이전 댓글 표시
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
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
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.
추가 답변 (1개)
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()?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Raspberry Pi Hardware에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!