Filter löschen
Filter löschen

cell multiplication with a vector

2 Ansichten (letzte 30 Tage)
David Kusnirak
David Kusnirak am 13 Jun. 2013
Hi,
I have a cell structure (Aa), where each cell is a square sparse matrix and I need to multiply each cell with a vector (fi) to produce a matrix Aaf.
my code to do this is:
Aaf=zeros(numel(sig),length(Aa));
for j=1:length(Aa);
Aaf(:,j)=Aa{j}*fi;
end
but it seems to be pretty ineffective, so I' ve tried to evaluate it using a cellfun, but it doesn't work
Aaf_test = cellfun(@(x) x * fi(:,1),Aa);
Does anybody know ho do the multiplication faster than the for loop?
thanks

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 13 Jun. 2013
Aaf_test = cellfun(@(x) x * fi,Aa,'un',0);
  1 Kommentar
David Kusnirak
David Kusnirak am 13 Jun. 2013
it works well thanks, but yields even worse performance, than the for loop..shame

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices 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