Hello everybody,
I have a table with 7 columns and many rows. The first column contains times and the remaining 6 data sets. I need to slice this table into columns. I cannot "make assumptions about how many sets of measurements are in the data file" i.e. I can't do this:
_t = raw(:,1);
d1 = raw(:,2);
d2 = raw(:,3);_ … where "raw" is the name of the table and d1, d2… is the name of the new row vector.
it has to work regardless of how many data sets there are. How can I do that?
Also, I have to do a linear fit or restricted linear fit on those vectors (x axis is always t and y axis is d1, d2…), depending on whether the vector starts with 0 or not. I came up with
_if d1(1,:) == 0
opts1 = fitoptions('poly1', 'Lower', [-Inf 0], 'Upper', [Inf 0]);
[f1, gof] = fit(t, d1,'poly1', opts);
else
[f1, gof] = fit(t, d1,'poly1');
end_
which works if I slice the columns one by one and change the d1, d2… but I assume that I need to make that into a loop? Something like "for ii = something"?
I hope you can understand my question, it's hard to explain…
I hope someone out there can help me! Thanks in advance!