Why does winopen not work well?

조회 수: 7 (최근 30일)
Haiquan
Haiquan 2024년 3월 16일
댓글: dpb 2024년 3월 19일
After ranning hundreds of lines of code and export for a mat table, code winopen the folder does not worked so well while busy is displayed at the botttom left corner? Even train sould has been player, the desired path is still not opened. If you only ran the cold winopen, it works well. I do not know why?
Does anybody know how to sovlve this? Appreciate for any help or any clue.
Belllow is the end of the code I have ran.
% omit of some code for processing
outputName = fullfile(path, ,'ResSal_Type.xlsx']);
writecell(Res, outputName, 'Sheet', 'Sheet1');
disp(sprintf('Finished'));
winopen(path)
load train % loads two variables, y and Fs
sound(y, Fs); % plays the sound
  댓글 수: 2
Mario Malic
Mario Malic 2024년 3월 16일
Code will continue after you close your application.
Haiquan
Haiquan 2024년 3월 16일
Thanks. In this condition do you know how to make sure the file will be opened by using winop(path)?

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

채택된 답변

dpb
dpb 2024년 3월 17일
편집: dpb 2024년 3월 17일
...
outputName = fullfile(path, ,'ResSal_Type.xlsx']);
writecell(Res, outputName, 'Sheet', 'Sheet1');
...
winopen(path)
...
You wrote to file outputName but then try to only open the folder -- that will open file explorer to the given folder but clearly should NOT open the file, that isn't what winopen() was asked to do.
Use
...
winopen(outputName )
...
instead.
  댓글 수: 7
dpb
dpb 2024년 3월 19일
To prove the above hypothesis, try commenting out the call to sound(y,FS) temporarily.
If the winopen() call then works as expected, it is the system sound call that is blocking the other OS system call. Unfortunately, it doesn't appear that sound is supported in the threaded functionality; one can hope that maybe a drawnow would let the system have a chance to dispatch the other code...
dpb
dpb 2024년 3월 19일
However, a trivial case here to try to illustrate seems to work...
winopen(cd)
load gong.mat;
sound(y);
A script containing only the above here works seemingly every time (warning--the gong is quite annoying if your speaker volume is set at any great magnitude...)
See if such a trivial case will work for you...if so, and your other code still doesn't, then it begins to look like something else not shown may be the culprit instead.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Just for fun에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by