필터 지우기
필터 지우기

How to split a column matrix into N parts

조회 수: 3 (최근 30일)
tyler seudath
tyler seudath 2021년 11월 5일
답변: Dave B 2021년 11월 5일
Hi Everyone,
I have a column matrix with dimensions 100000 x 1 and I want to split that column into 100 columns each containing 1000 of the datapoints. Is there a way to go about doing that?
Thank you,
Tyler Seudath

채택된 답변

Dave B
Dave B 2021년 11월 5일
reshape is a great way to do this:
x=rand(100000,1);
y=reshape(x,1000,100);
y1=reshape(x,1000,[]); % Because the 100 is determined, you can let MATLAB calculate it
y2=reshape(x,[],100); % Because the 1000 is determined, you can let MATLAB calculate it
x(1:10)
ans = 10×1
0.1711 0.5883 0.6202 0.0120 0.7058 0.5331 0.6814 0.0042 0.1854 0.1365
x(1001:1010)
ans = 10×1
0.7332 0.6696 0.3997 0.6966 0.6261 0.3499 0.3917 0.6445 0.1319 0.0736
y(1:10,1:2)
ans = 10×2
0.1711 0.7332 0.5883 0.6696 0.6202 0.3997 0.0120 0.6966 0.7058 0.6261 0.5331 0.3499 0.6814 0.3917 0.0042 0.6445 0.1854 0.1319 0.1365 0.0736

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by