필터 지우기
필터 지우기

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 CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by