フィルターのクリア

create large matrix from data

1 回表示 (過去 30 日間)
KA
KA 2016 年 4 月 9 日
コメント済み: KA 2016 年 4 月 11 日
Hi, I have imported some data from an excel spreadsheet as a numerical matrix 145x3 as shown below
I now want to transform these data into a much larger matrix of 145x522. Reading the table above, row 1 in this new matrix will have the value shown in cell 1:3 (0.2203) but only between the positions shown in cells 1:1 (start point) and 1:2 (end point) i.e. cells 1:1 to 1:12. Row 2 in the new matrix will have the value 0.1597 (all of the values are defined in the 3rd column) but only between the positions shown in cells 2:1 (start point) and 2:2 (end point) i.e. cells 2:2 to 2:12, and so on. Matrix positions that are undefined will be set to a value of zero.
Does anyone know how to do this?

採用された回答

dpb
dpb 2016 年 4 月 9 日
編集済み: dpb 2016 年 4 月 10 日
Just expand the output by rows is the "braindead" solution...assume the given array is dat
Nrow=size(dat,1); % the number of rows
Ncol=522; % whatever defines the column size
x=zeros(Nrow,Ncol);
for i=1:Nrow
x(i,dat(i,1):dat(i,2))=dat(i,3);
end
  1 件のコメント
KA
KA 2016 年 4 月 11 日
Thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by