how to make polyfit on call arrays?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ali mohebi
am 10 Apr. 2019
Kommentiert: ali mohebi
am 10 Apr. 2019
hello
i have a b=cell(1,32). each cell in b contains a matrix of three rows but, the number of columns may differ from one cell to other. cell contents are double arrays.i want to extract second row of cells, punch them together and save it in one column of a matrix. also for the third row the same procedure is needed and finally polyfit them against each other.
any idea?
thanks.
2 Kommentare
Cris LaPierre
am 10 Apr. 2019
Bearbeitet: Cris LaPierre
am 10 Apr. 2019
What does 'punch them together' mean? How do you plan to save multiple columns of data into a single column?
You say you want to do the same procedure for the third row. Again, how do you plan to put multiple columns of data into a single column? And where are you saving this? The second column of your matrix?
It might be easiest if, for a sample cell of data (3xn matrix of doubles), you show us an example of what you want the code to do.
Akzeptierte Antwort
Guillaume
am 10 Apr. 2019
It sounds like by punch you mean horizontally concatenate. In which case, what you want is easy to do:
%b a cell array of 3xN matrices
joined = [b{:}]; %can also use cell2mat(b) iif b is a row vector cell array
polyfit(joined(:, 3), joined(:, 2), degree)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!