View code generation readiness issues , c code generation from Matlab function
2 views (last 30 days)
Show older comments
Murugan C
on 26 Apr 2017
Commented: Walter Roberson
on 28 Apr 2017
Hi guys, I got some issues while generate the 'C' Code from Matlab Function.Issue like this "Unsupported MATLAB Function calls" & "Code generation tools may fail unless the issues listed below are fixed". The following basic MATLAB comments are not supported while generate the C code 1.input, 2.cell2mat, 3.xlsread, etc.
So can you guys please tell instead of these comments.?
Thanks Murugan
0 Comments
Accepted Answer
Walter Roberson
on 26 Apr 2017
The appropriate replacement for input() is going to depend upon how your code is getting its input. fgets() (followed by removing the line terminator) and getline() are possibilities if you are working with a stream input; gets() for unbuffered input. However, if you are generating for hardware, the hardware might not have streams or files or stdin and you might have to use a completely different kind of input.
xlsread() has no replacement in standard C or C++. You would need an external library -- presuming that the hardware you are using has a file system at all.
Some hints are using cells are at https://www.mathworks.com/help/simulink/ug/cell-array-restrictions-for-code-generation.html
Instead of cell2mat, you should create a 2D array of the proper size and copy out of the cell array into the 2D array.
2 Comments
Walter Roberson
on 28 Apr 2017
You have not indicated what your target hardware is. A lot of target hardware does not have a keyboard as such -- it is more likely to have buttons for input.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!