Lets say we have an Array A = ones(2, 2, 2)
and another matrix P = rand(4)
. I am wondering if it is possible to write the code
temp = A(:, :, 1);
X = P * temp(:);
into one line of code to save the memory consumed by temp
. I tried to run
X = P * A(:, :, 1)(:);
but that does not work. I also fumbled around with the reshape
command but could not make it work.
I could not find the answer using the web or this forum. Is it possible to do what I am looking for?
Thank you for the help,
Adrian