how to solve this error?

Hi , can you help please to solve this problem :
Error using * MTIMES is not fully supported for integer classes. At least one input must be scalar. To compute elementwise TIMES, use TIMES (.*) instead.
Error in cameramanlinenoisy0202combine (line 128) alphaB=VB*Z';
Best regards

Respuestas (2)

Adam
Adam el 2 de Feb. de 2016
Editada: Adam el 2 de Feb. de 2016

0 votos

It's hard to know exactly what your code is, but if you do what it says in the error message it may fix your problem if your matrices are of the correct size.
i.e.
alphaB=VB.*Z';
but without knowing the code and what size VB and Z are I can't be certain. If they are totally incompatible size then using .* will not work either.
The * operator is used for multiplying something by a scalar or doing matrix multiplication. If you have two matrices of the same size and you wish to do an element by element multiplication then you need to use the .* operator which does this. It also will not work though if you are trying to multiply a 3*6 matrix by a 4*5 matrix because there is no logical interpretation of what you are trying to multiply.
Walter Roberson
Walter Roberson el 2 de Feb. de 2016

0 votos

In the line
alphaB=VB*Z';
one of VB or Z is your image array, with VB being more likely. Whichever one it is, you need to convert to double precision. Try
alphaB = double(VB) * double(Z)';

2 comentarios

Vishnupriya C
Vishnupriya C el 25 de Sept. de 2016
i have used double but it shows the error as out of memory.can anyone suggest a solution?
Walter Roberson
Walter Roberson el 25 de Sept. de 2016
Remember that when you use A * B, that the size of the output array will be size(A,1) by size(B,2) -- the number of rows of the first by the number of columns of the second. That might require more memory than you have available. The temporary memory required for the calculation should be at most a vector max(size(A,1),size(B,1)) long.
You should check to see if what you need is instead A .* B, which is element-by-element multiplication, A(I,J) * B(I,J)
Generally when you do matrix multiplication using * the precision required for the output exceeds the precision of the input. If you are working with large matrices such that double() of the output will be too large for your memory but in native precision it would not be too large, and you are certain that the result of multiplication will not exceed the original precision, then you can do the multiplication in "chunks". For example instead of A * B you can do
out = zeros(size(A,1), size(B,2), class(A));
dB = double(B);
for row = 1 : size(A,1)
out(row,:) = double(A(row,:)) * dB;
end
clear dB
This reduces the amount that has to be converted to double precision at any one time to be size(B) together with a vector size(A,2) . If your B is notably bigger than your A then you can use a similar kind of manipulation to instead take double(A) as your working matrix.

Iniciar sesión para comentar.

Categorías

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 2 de Feb. de 2016

Comentada:

el 25 de Sept. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by