How I can get the dimension of matrix

조회 수: 76 (최근 30일)
Abduellah Elbakoush
Abduellah Elbakoush 2021년 12월 21일
답변: Cris LaPierre 2021년 12월 21일
I Have
B = dec2bin(123125)
B = '11110000011110101'
B = [repmat('0',rem(length(B),2)),B]
B = '011110000011110101'
A= reshape(B,2,[])' - '0'
A = 9×2
0 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 0 1
the result of A is 9*2 double
I want to put the dimension of matrix in x and y
such as
the value of x =9
the value of y =2

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 12월 21일
Use size perhaps.
B = dec2bin(123125);
B = [repmat('0',rem(length(B),2)),B];
A= reshape(B,2,[])' - '0';
[x,y]=size(A)
x = 9
y = 2

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by