How do I create a unit vector with multiple rows

5 ビュー (過去 30 日間)
Adam Wright
Adam Wright 2019 年 4 月 17 日
コメント済み: Adam Wright 2019 年 4 月 17 日
I want to create a unit vector with multiple rows, but only one input line.
For example I want an output like this: [14 15 16; 12 13 14].
I tried to put input of [14;12]:[1;1]:[16;14] and just got the output of [14,15,16] instead of mutiple rows.
All the vectors will be the same length so that won't be an issue.

採用された回答

madhan ravi
madhan ravi 2019 年 4 月 17 日
[14:16;12:14]
  3 件のコメント
madhan ravi
madhan ravi 2019 年 4 月 17 日
a=[14;2;48;21]
b=[16;4;50;23]
cell2mat(arrayfun(@(x,y)x:y,a,b,'un',0))
Adam Wright
Adam Wright 2019 年 4 月 17 日
Perfect. Thank you

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by