フィルターのクリア

known interation each cell of a matrix

1 回表示 (過去 30 日間)
baran
baran 2014 年 11 月 8 日
編集済み: Azzi Abdelmalek 2014 年 11 月 8 日
hi all, i have two columns , i want to write a code in matlab that produce a result column in which rows of it, each of values in the first columns , repeat as number of values in second columns. for example :
if first column=a second column=B
5.3 2
6.2 3
7.12 5
the result is
result column=C
5.3
5.3
6.2
6.2
6.2
7.12
7.12
7.12
7.12
7.12
how should i write it in matlab ?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 8 日
編集済み: Azzi Abdelmalek 2014 年 11 月 8 日
M=[ 5.3 2
6.2 3
7.12 5]
out=cell2mat(arrayfun(@(x,y) x*ones(y,1),M(:,1),M(:,2),'un',0))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by