查看单个帖子
旧 2019-11-27, 10:02   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 matlab coder requirements stricter than normal matlab

Consider the following matlab program:



function results = prog()
opts.x = 1;
if ~isfield(opts, 'y'); opts.y = 1; end
'asdf'
return


I am able to run this program successfully in matlab however when I try to use coder to convert it to C I get the following error:



This structure does not have a field 'y'; new fields cannot be added when structure has been read or used.


I would like to know if there is a way to convert to C using coder (or possible some other tool) that does not use a stricter compiler as seems to be the case with coder as I am using it. I am using matlab version R2019B.



Please note that this is just one of many examples of how coder is using a stricter compiler than normal matlab. I have a fairly large program that I would like to convert to C and I don't want to have to go through each error (there are over 100).





More answer...
poster 当前离线   回复时引用此帖