memory lost with a simple code

2 次查看(过去 30 天)
Hello!
I was trying to optimize my image-processing software to make it use less memory and was very surprised to see that the very first function, which simply requests the user to specify a folder, writes it to file, then displays its path in a text element and makes two more text elements invisible, - results in decrease of the memory available for all arrays by 33 Mb! Where are they gone?
Here is the function code:
function SetCurrDir
global currdirpath hTxtCurrDir hTxtProcessDisplDone hTxtProcessContinueDone
currdirpath=uigetdir;
fid1=fopen('CurrDir.txt', 'wt');
fprintf(fid1, '%s', currdirpath);
fclose(fid1);
set(hTxtCurrDir, 'String', {'Current directory is', currdirpath}, 'Visible', 'on');
set(hTxtProcessDisplDone, 'Visible', 'off');
set(hTxtProcessContinueDone, 'Visible', 'off');
clear fid1;
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by