Could anyone help me to solve the issue.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
jaah navi
am 13 Sep. 2019
Kommentiert: madhan ravi
am 19 Sep. 2019
I am having matrix
A=[1 2;
2 3;
2 4]
when i use the command
NN = num2cell(num2cell(A),2)
partdisp(NN)
i am getting the result as
NN =
{1x2 cell}
{1x2 cell}
{1x2 cell}
The formation of clusters :
{1} {2}
{2} {3}
{2} {4}
but i need to have the result in the following manner
NN =
{1x1 cell}
{1x1 cell}
{1x1 cell}
The formation of clusters :
{1 2}
{2 3}
{2 4}
could anyone please help me on it.
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 13 Sep. 2019
Bearbeitet: madhan ravi
am 13 Sep. 2019
NN = num2cell(num2cell(A,2),2)
4 Kommentare
madhan ravi
am 19 Sep. 2019
mat2cell(A,[1,1,1],[2,3,1,1]) % see the documentation and learn how to use it
Weitere Antworten (1)
Fabio Freschi
am 13 Sep. 2019
For your case
NN = mat2cell(A,[1 1 1],2)
A bit more general
NN = mat2cell(A,ones(size(A,1),1),size(A,2))
5 Kommentare
Adam
am 13 Sep. 2019
Yeah, even just opening a question and typing your answer can take long enough that when it's posted there are 2 or 3 other answers too. It's perfectly fine though.
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!