필터 지우기
필터 지우기

want a rows to split into multiple rows

조회 수: 3 (최근 30일)
VASUNDHARA V
VASUNDHARA V 2022년 2월 24일
댓글: VASUNDHARA V 2022년 2월 25일
A=[111111111111111111]
i want to generate A=[111111
111111
111111]
it is (3,6) matrix...I know it can be done easily through semicolon but that i dnt want because that A matrix is the output basically.
i also used reshape command but for that dimension shoud be same. i have taken just for example (3,6).actually the matrix is of (1,90) .i wangt to make it (3,30)
kindly help

채택된 답변

Jan
Jan 2022년 2월 24일
편집: Jan 2022년 2월 24일
X = ones(1, 90);
Y = reshape(X, 3, []); % 2nd argument is determined automatically
% The long form:
Y = reshape(X, 3, numel(X) / 3);
  댓글 수: 6
Jan
Jan 2022년 2월 24일
@VASUNDHARA V: A hint for future questions: You see, that 1:12 is a better example to demonstrate, what you want to achieve than "A=[111111111111111111]". Note that this is not even a vector, but a huge scalar.
VASUNDHARA V
VASUNDHARA V 2022년 2월 25일
thankyou sir

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

DGM
DGM 2022년 2월 24일
I don't see why reshape() wouldn't work
A = ones(1,90);
A = reshape(A,3,30)
A = 3×30
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

카테고리

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