How can we convert programs made on older version to be available on newer version of MATLAB?

조회 수: 13(최근 30일)
I created MATLAB program on 2014b by using GUIDE.
Recently, we face the trouble mainly due to windows update (Windows 10: ver.1709 -> 1909)
So, I would like to convert that program so that it can be executed & compiled on newer version (ex. 2016b).
If you have any useful information for this topic, could you share it with us?
Thank you very much for your help in advance!
  댓글 수: 2
Hide 2020년 12월 8일
Thank you for your advice.
Instead of tiny program, I can show the error we face. (because it takes some time to make it)
Error using xlswrite (line 219)
The file C:\Users\Public\XXX.xlsx is not (I just changed the path and file name)
writable. It might be locked by another process.
Is this information useful?

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


Walter Roberson
Walter Roberson 2020년 12월 8일
I do not recall the exact release at the moment, but somewhere around R2016b, MATLAB changed xlsread() and xlswrite() so that they cached connections -- holding open a connection to Excel instead of opening it, doing the operation, and closing it again. This can improve I/O performance notably.
The drawback is that if you are using the same file in multiple processes or multiple MATLAB sessions, then a process might not be able to get access to the file when it wants it, because some other process has the connection open.
In previous releases, if you had that kind of situation, then unless all of the processes coordinated their activity, you could end up with different contents "by chance" depending on which process raced fastest. As opposed to an error being given by the additional process that cannot access the locked file.
I do not recall any method of telling MATLAB not to cache the connections. However, you could use the File Exchange contribution to do the writing. That contribution was designed to allow you to cache the connections, in the days before MATLAB cached connections -- but because you get source code, you can also close the connection whenever you want.
In some of the releases later than yours, around R2018b, MATLAB deals with the situation with writetable() by offering a way for writetable() to not access Excel at all. Which introduces other race conditions if you do have multiple processes working with the file.
Anyhow, unless you have special requirements such as needing to format cells at the Excel level, I suggest you consider switching to readtable() and writetable()

Paul Hoffrichter
Paul Hoffrichter 2020년 12월 8일
I had problems with Excel in general when a Windows upgrade to Windows Defender occured. Defender started marking certain folders including the Documents folder unwritable except for allowed programs. It was awhile ago, and the IT changed to Webroot AV (and problem went away). I had to go in and give access to Excel.
>> It might be locked by another process.
In general I get this error frequently when I switch Git branches locally, and then switch back again. The problem was that I no longer had access to some folders. Using the Linux ls command, I could see the folder, but could not go into it from the command line. My solution is to close Windows Explorer that was looking at the MATLAB folders, Git Bash, Gitk, and even MATLAB. Restarting then made this problem go away. In fact, the folder would no longer be there (since the Git branch did not have it).


Find more on Get Started with MATLAB in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by