use of built in functions; manipulating data arrays

4 ビュー (過去 30 日間)
metin yilmaz
metin yilmaz 2020 年 11 月 8 日
コメント済み: Matt J 2020 年 11 月 9 日
Would you please explain when this works
>> d = [1, 2, 3; 4, 5, 6];
f = size(d)
f =
2 3
>> [rows,cols] = size(d)
Why is it that this does not work?
>> [rows, cols]=[2 3]
Too many output arguments
Thank you.

採用された回答

Matt J
Matt J 2020 年 11 月 8 日
編集済み: Matt J 2020 年 11 月 8 日
The operation [2,3] is a matrix concatenation, which has only 1 output (the concatenated matrix). It is equivalent to making the following function call,
horzcat(2,3)
ans = 1×2
2 3
This is what you want to do instead,
[row,col]=deal(2,3)
row = 2
col = 3
  3 件のコメント
Stephen23
Stephen23 2020 年 11 月 9 日
"I have three different basic matlab books with the pages about 300,400, and 700 respectively but unfortunately they don't cover functions I encounter in matlab forums. They don't also cover horzcat and dial. "
This is the best place to learn MATLAB:
That page links to tutorials you can work through yourself, and the MATLAB Onramp is a series of videos that teaches basic concepts that you will need to know. Don't waste your time with out-of-date, half-baked, flawed books.
Matt J
Matt J 2020 年 11 月 9 日
Thank you for your all introducing functions horzcat and the concept matrix concatenation.
You're welcome. If this resolves your question, though, please Accept-click the answer.

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

その他の回答 (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