Get values of workspace with same matrix format.

조회 수: 2 (최근 30일)
Arpitkumar Patel
Arpitkumar Patel 2021년 6월 14일
편집: KSSV 2021년 6월 14일
Hello,
How can I perform ifelse command, so that I can reorder the matrix values (column*rows) to same as I want.
ex. I have two variable in workspace with values,
A = [123*1] & B = [1*456],
In this case, I want to transpose B value. So, I want to use 'ifelse', so that it checks and if any matrix comes with row matrix, it changes to column matrix.
Thanks in advance.

답변 (1개)

KSSV
KSSV 2021년 6월 14일
편집: KSSV 2021년 6월 14일
You can simply use B(:); this will always give the result as column matrix.
If you want to use if, else
if size(B,1)==1
fprintf('B is a row matrix')
end
Alos you have a inbuilt function for this. Read about isrow.

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by