How can I avoid the fill-in problem?

조회 수: 3 (최근 30일)
Ricardo Boza Villar
Ricardo Boza Villar 2015년 4월 25일
댓글: Ricardo Boza Villar 2015년 4월 26일
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
Star Strider
Star Strider 2015년 4월 26일
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 2015년 4월 26일
Many thanks to the three of you.

댓글을 달려면 로그인하십시오.

답변 (2개)

Jan
Jan 2015년 4월 26일
편집: Jan 2015년 4월 26일
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
Star Strider
Star Strider 2015년 4월 26일
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.

댓글을 달려면 로그인하십시오.


John D'Errico
John D'Errico 2015년 4월 26일
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.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by