Construct an object of fitobject (cfit) with a vector of parameters in MATLAB

StackOverflow https://stackoverflow.com/questions/20400674

  •  29-08-2022
  •  | 
  •  

سؤال

Is there a possibility to construct a cfit-object with a vector of parameters like:

param = [17,-77,95,112];
ft = fittype('poly3');
result = cfit(ft,param);

instead of:

ft = fittype('poly3');
result = cfit(ft,17,-77,95,112);

Thanks in advance!

هل كانت مفيدة؟

المحلول

use the comma-separated list operator : together with cell arrays::

param = {17,-77,95,112};
result = cfit(ft,param{:});

you can get param in cell form with mat2cell.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top