Subscripting into an mxArray is not supported.
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Sriharsha
il 13 Mar 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
Risposta accettata
Ryan Livingston
il 24 Giu 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 Commenti
Più risposte (1)
Image Analyst
il 23 Giu 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()?
0 Commenti
Vedere anche
Categorie
Scopri di più su Raspberry Pi Hardware in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!