how to make polyfit on call arrays?

3 ビュー (過去 30 日間)
ali mohebi
ali mohebi 2019 年 4 月 10 日
コメント済み: ali mohebi 2019 年 4 月 10 日
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 件のコメント
Cris LaPierre
Cris LaPierre 2019 年 4 月 10 日
編集済み: Cris LaPierre 2019 年 4 月 10 日
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.
ali mohebi
ali mohebi 2019 年 4 月 10 日
編集済み: ali mohebi 2019 年 4 月 10 日
Apology, that is saving in one 'row' not column.I have attached just one cell out of 32 (the original fie is not in xlsx format). As u see it contains three rows and 11 columns (all 32 cells have three rows) but, other cells may have different column numbers. Now i want to extract the first row of all cells and save them in one 'row'. (by 'punch them together', I mean after extraction of first row of first cell,the extracted first row of second cell comes after it and this continues till the end). Same is done for second rows of cells. Now we have two rows of the same length which should be polyitted against each other. any question is pleased.
thanks

サインインしてコメントする。

採用された回答

Guillaume
Guillaume 2019 年 4 月 10 日
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)
  1 件のコメント
ali mohebi
ali mohebi 2019 年 4 月 10 日
Great thanks, Guillaume.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by