# MATLAB: How to extract multiple cfit or fit values into one table

cfitextractMATLABMATLAB and Simulink Student Suitemultiple fit coefficients into a table.

Dear all,
So I have a 31x 19 matrix data and I had to fit the first column data (31X1) and the rest of all the 18 columns (31×18).
I wrote a simple if function to do this but my challenge now is about how to extract each fit coefficients (f) including confidence intervals into one Table. I already used coeffvalues but only returns my last f as the ans
Mycode is a follows
r = randi([0, 100], 31,19)
b = (r(:,1));b2=b(:,2:end);
for i= 1:size(b2,2)
% [f, gof_info] = fit(b1,b(:,2),'power1');
f{i}= fit(b, b2(:,i),'power1')
%f_values= coeffvalues(f{i})
end
Your help will be deeply appreciated.
Thanks
E

r = randi([0, 100], 31,19) %Power functions are unable to fit to data where X may contain nonpositive values; change the range from [0-100] to [1-100]b = (r(:,1));b2=b(:,2:end); %I think you meant to write b2 = r(:,2:end)for i= 1:size(b2,2)f{i}= fit(b, b2(:,i),'power1') %The appropriate syntax for a fit function would be f = fit(b, b2(:,i),'power1')end