フィルターのクリア

Can I get the column num of a matrix in one command?

3 ビュー (過去 30 日間)
Clark
Clark 2012 年 9 月 6 日
Hello,
I have a matrix, named A. I want to get the the number of columns in the matrix in one command. Is this possible? It seems like it should be easy. So far, I can only do it by creating a new variable, like so:
temp = size(A); columns = temp(1,2); clear temp;
Basically, can I do the above in one command? I'm not familiar with any such function. I tried some things like:
(size(A))(1,2)
{size(A)}(1,2)
size(A)(1,2)
Thanks, Clark
P.S. - I'm a MATLAB beginner, obviously.
  1 件のコメント
Image Analyst
Image Analyst 2012 年 9 月 6 日
A lot of functions have additional, optional inputs and outputs. When you have questions like this, you can look up the function in the help and find out if any of those options can get you what you want. For example, size() takes a second input that is the dimension along which you want the size.

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 6 日
size(A,2) %number of columns

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by