Function output 'data' cannot be of MATLAB type
显示 更早的评论
function data = readtxt()
fid = fopen('data_out.txt');
data=fscanf(fid,'%5d',inf);
fclose(fid);
end
This Function can run in matlab without any error.But in "Embedded MATLAB Function" of simulink result in some error.
"Function output 'data' cannot be of MATLAB type.
Function 'Embedded MATLAB Function' (#56.0.108), line 1, column 1:
"function data = readtxt()"
"
回答(1 个)
Walter Roberson
2013-5-4
Initialize data before assigning to it.
Michael Hosea wrote,
Your return values are mxArrays and can't mix
with your Embedded MATLAB data. If you know the size and type, you can
pre-declare it, and the compiler will generate the necessary code to convert
an mxArray to a native C data type
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!