How to split one big matrix in several matrices?

2 views (last 30 days)
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 Comments
AMBIKA P S
AMBIKA P S on 20 Feb 2019
Edited: AMBIKA P S on 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
Walter Roberson
Walter Roberson on 23 Feb 2019
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.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 3 Jan 2018
cellfun(@(V) reshape(V, 24, 3), num2cell(a,1), 'uniform', 0)

More Answers (0)

Categories

Find more on Cell Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!