Using cell array to create 3D sparse matrix.

3 Ansichten (letzte 30 Tage)
Collet Bastien
Collet Bastien am 2 Okt. 2012
Hello, I would like to create a 3d-sparse matrix. Ofc, I know that matlab's toolbox doesn't have it so far.
Here is my code :
C=zeros(m^nun,m,nu);
I would like to use a cell array filled with 2d sparse matrix. Something like :
A = zeros(m^nun, 1);
B = cell(size(A));
SP = sparse(m, nu);
for j=1:m^nun
B{j} = SP;
end
Is it the right way to do it ?
Furthemore, can I use my matrix B in the same way as my matrix C ? For example, here is my code (and it works) :
C(1:x,A,1)=N;
But is it going to work with my matrix B as well ? (by doing : B(1:x,A,1)=N;)
Thank you, and sorry for the long post.

Antworten (1)

Matt J
Matt J am 2 Okt. 2012
Bearbeitet: Matt J am 2 Okt. 2012
Consider using this FEX contribution instead
It will let you do many/most things that you can do with 3D full arrays.
  17 Kommentare
Collet Bastien
Collet Bastien am 10 Okt. 2012
Bearbeitet: Collet Bastien am 10 Okt. 2012
Ok,I'm looking for a new matlab version, I'm also going to send you the variables too.
Matt J
Matt J am 10 Okt. 2012
I received your file, but
PV(:,:,1)=AAA;
works fine for me. I'm betting that upgrading will fix it.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrix Indexing 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!

Translated by