Answer to Question #5930 in MatLAB | Mathematica | MathCAD | Maple for Purvi

Question #5930
Hi, I am working on my project on matlab where I have to divide an array of size 1X711000 in to subarrays of size of 1X100. Can I use the command mat2cell command for it? Please give the proper command for it.
Expert's answer
Suppose your array is called A and has size 1 x N*M, so it is a row.
To
divide it into N cell arrays of length M use the command:
C =
mat2cell(A,[1],ones(1,N)*M);

Now to access the i-th M-tuple you should
run
C{i}

In your case you should run
C =
mat2cell(A,[1],ones(1,7110)*100);
===============================

Another
approach is to convert A into M x N array (M rows and N columns) by the
command
D = reshape(A,M,N)
Then to access the i-th M-tuple
run
D(:,i)
In your case use the command
D =
reshape(A,100,7110)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal