Subscripting into an mxArray is not supported.

3 Ansichten (letzte 30 Tage)
hanaa
hanaa am 22 Jun. 2014
Kommentiert: Sriharsha am 13 Mär. 2015
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 Kommentar
Sriharsha
Sriharsha am 13 Mär. 2015
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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Ryan Livingston
Ryan Livingston am 24 Jun. 2014
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 Kommentare
hanaa
hanaa am 4 Jul. 2014
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.
<<
>>

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Image Analyst
Image Analyst am 23 Jun. 2014
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()?

Kategorien

Mehr zu Raspberry Pi Hardware finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by