How to split one big matrix in several matrices?

I'm trying to split a 72x10 matrix in 10 24x3 matrices. The new matrices need to have in each line, 3 elements (which make 3 columns) of each column of the original 72x10 matrix. I tried to use mat2cell but always get the error "Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [72 10]". I'm clearly not understanding something here.

2 Kommentare

AMBIKA P S
AMBIKA P S am 20 Feb. 2019
Bearbeitet: AMBIKA P S am 20 Feb. 2019
Also, could someone please clarify on how to split a 70x6 matrix into seven 10x3 matrices using the above code? What is 'V' here? Is it a function which we use to perform other calculations on the split matrices? and also, what is 'a'?
numOfSensors = 10;
numOfSets = 7;
%% sample data preparation
x = 1:3;
y = rand(length(x), numOfSets*numOfSensors);
yCell = mat2cell(y, 3, numOfSensors*ones(1,numOfSets)); % this is my sensor data
ycell = {3x10} {3x10} {3x10} {3x10} {3x10} {3x10} {3x10}
I have converted the matrix to cell arrays. How do i use scatter3 on each cell array.
Could someone please clarify? Thank you for your help in advance
Is the "70x6" a mistake? You show a 3 x 70 array and ask about spitting into something that has as many total elements as would be present in (3 x 70); if the original data is 70x6 then half of the inputs need to be omitted in the output.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 3 Jan. 2018

0 Stimmen

cellfun(@(V) reshape(V, 24, 3), num2cell(a,1), 'uniform', 0)

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by