Filter löschen
Filter löschen

How can i form a 3d matrix from a 2d matrix

1 Ansicht (letzte 30 Tage)
Arijit Ghosh
Arijit Ghosh am 10 Mai 2017
Bearbeitet: Jan am 10 Mai 2017
Hello I am struck in a problem for long time. I have got a 2D matrix of size 19x1339. I have another parameter pi=p*ch*win. Where p=1;ch=21;win=56. I wish to make a 3D matrix of dimension pi x 19 x 1339 without inserting zeros in the matrix. Can anyone please help me? It is really very urgent. I am doing the following: Here WCOH and WCS have the dimension 19 x 1339.
pi=p*ch*win;
xcoh(pi,:,:)=WCOH;%ADD coherence feature for each window here
xcs(pi,:,:)=WCS;
  3 Kommentare
Arijit Ghosh
Arijit Ghosh am 10 Mai 2017
Actually I am running a loop of (number of patients*number of channel*number of windows), which is denoted by pi. This pi then have the value 1*21*56 which is equal to 1176. I wish to insert this 1176 into my 3D matrix.
Jan
Jan am 10 Mai 2017
Bearbeitet: Jan am 10 Mai 2017
The question is not clear. Where do you want to insert 1176? Please post a small example, with e.g. "pi=2" and "WCS=magic(2)".
Please do not use "pi" as name of the variable, because this shadows the builtin function pi, which replies teh value of Pi.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jan
Jan am 10 Mai 2017
Perhaps you mean:
xcs = repmat(reshape(WCS, 1, 19, 1339), 1176, 1, 1);
But this 3D array would consist of 1176 identical slices and this redundancy would be really inefficient.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by