Alternative to textread on Linux
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm currently using textread to load a text file for later display in an edit field on my GUI. However, I'm in Linux, and discovered memory isn't freed up - so, my program got really slow, and I had to close MATLAB because I keep loading more and more text files. Is there a way to display my text file without loading the whole thing into memory?
댓글 수: 0
채택된 답변
Walter Roberson
2012년 12월 3일
You should be using textscan() instead of textread()
There is no way in MATLAB to display the content of a file in a uicontrol() editbox without loading the file in to memory.
If you set() the String property of the uicontrol to be the cell array of strings, then due to MATLAB's copy-on-write behavior, this will not duplicate the storage of what was read in, only share it (until one of the two locations changes.)
댓글 수: 2
Walter Roberson
2012년 12월 3일
The memory is cleared automatically when the variable you read it in to is deleted -and- the String property of the editbox is set to something else.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!