Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
05.07.2019, 13:37 GMT-4
Updated:
5 years ago
05.07.2019, 13:37 GMT-4
Hi Shawn
Usually the error message means that the file is indeed used by another program. Do you have the file open in the Comsol GUI? Do you see a file with the same name as your model, but with the extension .lock?
What operating system are you using? Where is the file stored?
Your problem can probably be fixed by opening the file in Comsol and resetting the lock.
-------------------
Lars Gregersen
Comsol Denmark
Hi Shawn
Usually the error message means that the file is indeed used by another program. Do you have the file open in the Comsol GUI? Do you see a file with the same name as your model, but with the extension .lock?
What operating system are you using? Where is the file stored?
Your problem can probably be fixed by opening the file in Comsol and resetting the lock.
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
17.07.2019, 23:45 GMT-4
Updated:
5 years ago
17.07.2019, 23:47 GMT-4
Hi Shawn
Usually the error message means that the file is indeed used by another program. Do you have the file open in the Comsol GUI? Do you see a file with the same name as your model, but with the extension .lock?
What operating system are you using? Where is the file stored?
Your problem can probably be fixed by opening the file in Comsol and resetting the lock.
Hi Gregersen
The file is being loaded by MATLAB with the "mphopen". At the meantime, I open this MTALAB loaded model with COMSOL GUI. Then when I make some changes in the COMSOL GUI, I found I cannot save this model since it has been locked by another program (I gauss it's MATLAB).
Because I also open this model with COMSOL GUI, there is a file with the same name as the model, and with the extension .lock.
I use Win 10.
Since it has been loaded by MATLAB and opened by COMSOL GUI, I think that's the reason why COMSOL GUI claimed the model is locked by another program (MATLAB).
Do you have some solution for this kind of case? Thanks!
>Hi Shawn
>
>Usually the error message means that the file is indeed used by another program. Do you have the file open in the Comsol GUI? Do you see a file with the same name as your model, but with the extension .lock?
>
>What operating system are you using? Where is the file stored?
>
>Your problem can probably be fixed by opening the file in Comsol and resetting the lock.
Hi Gregersen
The file is being loaded by MATLAB with the "mphopen". At the meantime, I open this MTALAB loaded model with COMSOL GUI. Then when I make some changes in the COMSOL GUI, I found I cannot save this model since it has been locked by another program (I gauss it's MATLAB).
Because I also open this model with COMSOL GUI, there is a file with the same name as the model, and with the extension .lock.
I use Win 10.
Since it has been loaded by MATLAB and opened by COMSOL GUI, I think that's the reason why COMSOL GUI claimed the model is locked by another program (MATLAB).
Do you have some solution for this kind of case? Thanks!
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
14.11.2019, 22:21 GMT-5
Updated:
5 years ago
14.11.2019, 17:21 GMT-5
Shawn,
I had the same problem as you (and still have half of the problem to solve).
I did some searching in the LiveLink for MatLab User Guide and found this function that releases the mph file from being locked by MatLab:
ModelUtil.remove('Model')
In order to get this to work in my Command Window in MatLab, I write, verbatim:
import com.comsol.model.*
import com.comsol.model.util.*
ModelUtil.remove('Model')
Then I am able to save the mph file in my Comsol GUI.
The second half of MY problem still exists because I don't know how to release the lock that the Comsol GUI now has on the file. So I cannot go back and forth (making a few model changes in MatLab then in the Comsol GUI, then in MatLab again, then in Comsol again, etc.) because I only know how to do the MatLab --> Comsol GUI direction. I'll post again if I figure out the second half of this puzzle.
Hope this helps you.
Alex
Shawn,
I had the same problem as you (and still have half of the problem to solve).
I did some searching in the LiveLink for MatLab User Guide and found this function that releases the mph file from being locked by MatLab:
ModelUtil.remove('Model')
In order to get this to work in my Command Window in MatLab, I write, verbatim:
import com.comsol.model.*
import com.comsol.model.util.*
ModelUtil.remove('Model')
Then I am able to save the mph file in my Comsol GUI.
The second half of MY problem still exists because I don't know how to release the lock that the Comsol GUI now has on the file. So I cannot go back and forth (making a few model changes in MatLab then in the Comsol GUI, then in MatLab again, then in Comsol again, etc.) because I only know how to do the MatLab --> Comsol GUI direction. I'll post again if I figure out the second half of this puzzle.
Hope this helps you.
Alex
Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
15.11.2019, 04:46 GMT-5
Hi
The solution is this:
Load the model into Matlab using mphopen.
Use mphlaunch to open the Comsol GUI with the same model as in Matlab.
Since the model is really loaded by Comsol Multiphysics Server you can update the model settings either from Matlab or from the Comsol GUI and both programs can save the file at any time.
-------------------
Lars Gregersen
Comsol Denmark
Hi
The solution is this:
Load the model into Matlab using mphopen.
Use mphlaunch to open the Comsol GUI with the same model as in Matlab.
Since the model is really loaded by Comsol Multiphysics Server you can update the model settings either from Matlab or from the Comsol GUI and both programs can save the file at any time.
Please login with a confirmed email address before reporting spam
Posted:
5 years ago
15.11.2019, 17:33 GMT-5
Updated:
5 years ago
15.11.2019, 12:33 GMT-5
Thanks, Lars, that's exactly what I was looking for!
Thanks, Lars, that's exactly what I was looking for!