How to split a column matrix into N parts

3 次查看(过去 30 天)
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