I currently do this:
x1 = {...}; %a 1xn cell with each element being a column vector
w = [...]; %some column vector
result = zeros(n,1);
% now I want to multiply each vector in x by w
for i = 1:n
result(i) = w'*cell2mat(x1(i));
end
This works of course but the idea behind Matlab is to make use of it’s optimised vector and matrix multiplication etc. So I though I’m probably doing something wrong. Is there a better way of doing the above performance-wise?
I think you can replace your
forloop with just: