Can I use mat2cell to divide a long column vector into several equal sized vectors?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Xiaohan Du
el 23 de Sept. de 2016
Respondida: Star Strider
el 23 de Sept. de 2016
Hello,
I see the use of mat2cell, e.g. a = mat2cell(b, [m n], [x y z]). This means I'll have to assign value to m and n.
Is there a way to use a variable instead of scalar to indicate size of cells in mat2cell? For example,
b = rand(100, 1);
c = 5;
a = mat2cell(b, [c]);
So that a results in 5 cells which is 20 by 1 vector each.
Thanks!
0 comentarios
Respuesta aceptada
Star Strider
el 23 de Sept. de 2016
Yes:
a = mat2cell(b, fix(size(b,1)/c)*ones(1,c), 1);
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!