Borrar filtros
Borrar filtros

Replacement for bsxfun(@times)?

3 visualizaciones (últimos 30 días)
Michael
Michael el 21 de Jul. de 2014
Respondida: John D'Errico el 21 de Jul. de 2014
In my code I have the following data sets:
r = <150902x1 double>
specR = <301x1 double>
Now entering the following commands creates
red = bsxfun(@times, r, specR');
red = <150902x301 double>
This works perfectly for the purposes of my script. However, when I make the r and specR arrays larger, I keep on running into memory errors where Matlab cannot create the massive arrays resulting from the bsxfun. Any suggestions on how to work around this memory error? Perhaps is there another function that I can use instead of bsxfun that only computes one line of the red array at a time? Thank you for your help in advance!

Respuestas (1)

John D'Errico
John D'Errico el 21 de Jul. de 2014
You are trying to generate a LARGE array. Can you be remotely surprised that it blows your memory up? The issue is not with bsxfun, unless you really don't need that large array at all, but just need to compute something small from it.
USE A LOOP. What is the problem?

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by