Code generation only supports cell operations for varargin and varargout.
    3 ビュー (過去 30 日間)
  
       古いコメントを表示
    
I want to convert my matlab code to c code but the code readiness report is genrating some error.Everytime i am using a cell array it is saying that= Code generation only supports cell operations for varargin and varargout.
I tried to put normal brackets() instead of curly brackets but then also it was showing error in the following code below:
 main_fn ={'algorithm'};
  pm_fn = {'pm_tau','pm_window','pm_keypoints','pm_harris_prctile','pm_searchrange'};
I also tried this notation
 main_fn(1).algorithm='algorithm';
but still was receiving an error of function not predefine So is there any alternative way of defining these functions/strucutures???
Also in the code below in the curly bracket portion i was receiving the same error as above
%check for unknown option
fn_unknown = setdiff(fn, [main_fn,pm_fn,m_fn]);
for i=1:length(fn_unknown),
    warning('Unknown option "%s".',*fn_unknown{i});*
end
0 件のコメント
回答 (1 件)
  Walter Roberson
      
      
 2015 年 6 月 27 日
        As I explained before, C is totally lacking in dynamic structures. Every structure must have an exact type (but that type can include unions). For example you can have your options stored as a structure array with fields such as optionname, ndim, arraysize, arrayclass, data . When ndim and arrayclass are each restricted to a small number of possibilities, that leads to an enumerable number of C data types such as
union dataunion { double* double_1D; double **double_2D; short* int16_1D; short** int16_2D  };
that can be used to access the data legally in C.
But since this is all option data you might find it a lot easier to convert all of the options to 2D double (that might happen to have a dimension of 1 if they are a vector) and then your structure has fields optionname, heightwidth, data . The names are now data and not fieldnames.
Convert your cell array of strings to a blank-padded char array and loop through the rows checking strcmp(optionname, strtrim(optiontable(K,:)))
I do not know for sure, but possibly if you code as
optiontable = char({'first'; 'second'; 'thirdoption'});
then it might be able to generate the table for you instead of requiring you to code like ['first '; 'second '; 'thirdoption']
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Logical についてさらに検索
			
	製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

