Using cell array to create 3D sparse matrix.

3 次查看(过去 30 天)
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.

回答(1 个)

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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by