How can I avoid the fill-in problem?

3 visualizaciones (últimos 30 días)
Ricardo Boza Villar
Ricardo Boza Villar el 25 de Abr. de 2015
Comentada: Ricardo Boza Villar el 26 de Abr. de 2015
I would like to know if there is a way to avoid the fill-in problem adding some code lines to the script. The thing is that when that happens to me the computer doesn't respond at all. I can't even open msconfig to stop the program from there, so I just end up turning off the computer. If this happened to me in the middle of an exam, I don't think it would be very pleasant.
  6 comentarios
Star Strider
Star Strider el 26 de Abr. de 2015
The only solution I’ve found is going to the Task Manager (Windows) and closing MATLAB from there, since it also won’t respond to clicking the red x at the top right of the MATLAB window.
I agree, it would be nice if there was some sort of warning. Put in an enhancement request for something that monitored memory usage, and could have the user set a threshold for matrix size.
The time I most recently encountered it was when I was doing a simple linear regression with long vectors. As the first column (a column vector of ones used to calculate the intercept), I mistakenly typed ‘ones(length(x))’ instead of ‘ones(length(x),1)’. That essentially crashed MATLAB, at least by my definition.
Ricardo Boza Villar
Ricardo Boza Villar el 26 de Abr. de 2015
Many thanks to the three of you.

Iniciar sesión para comentar.

Respuestas (2)

Jan
Jan el 26 de Abr. de 2015
Editada: Jan el 26 de Abr. de 2015
You can limit the size of created arrays in Matlab 2015a. See http://www.mathworks.com/help/matlab/release-notes.html "Array Size Limit" (Sorry, this link will not work anymore when R2015b is released)
With older Matlab versions you cannot prevent that the user provides insane commands. And even with the newest version a stubborn or careless user can kill the machine.
  1 comentario
Star Strider
Star Strider el 26 de Abr. de 2015
I missed that when I read the Release Notes. Thanks.
I hope the functionality still exists in R2015b.
The link may work if the documentation for previous versions remains. It just won’t redirect to the R2015b documentation.

Iniciar sesión para comentar.


John D'Errico
John D'Errico el 26 de Abr. de 2015
I'm sorry, but there is simply no substitute for thinking about what you are doing. Look at what you have written before you hit enter, before you cause the code to execute. If you are unsure about it, test out a code fragment on a small problem.
Write modular code. Test each module separately. Then when you put it all together, you can be confident it will run smoothly.
The fact is, once you get used to being careful in your coding, code gets easy to write, because you KNOW that it will work as you have written it.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by