MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

How I can resolve the problem in saving file *.ms after a simulation?

I use MATRIXx 6.2 and from a month I also use 6.3.
When I execute a math script from the command line of Xmath and then I change the macro file I'm not be able to save/create a backup version of the file if I use UltraEdit (but I can save my changes in the original file). If instead I use Crimson Editor (I find it reading this forum) I can't save the file. The program tell me "Access to .... .ms was denied". I can only exit Xmath and then I'm able to save the file.
I don't know if this is a problem of Matrixx, a problem of O.S. (Windows 2000) or an edito Problem.

Thanks,
Francesco
0 Kudos
Message 1 of 6
(8,316 Views)
Francesco,

I believe the issue here is that the mathscript file is in use. This is a standard problem with any software. You should not be able to edit a file while it is in use in another application. For instance, if you open Xmath and run the mathscript file from the command line, then go to the file in windows explorer and try and change the filename it should generate an error saying the file is in use. This only applies to files that are being executed. I have attached 2 mathscript files. One executes and finishes after being called from the command line. The other mathscript file has a pause command in it and will therefore be executing until you click the continue button. If you run the mathscript without the pause and then open Crimson E
ditor you will be able to edit the file, save it and then rerun the mathscript and see the changes. If however you run the mathscript file with the pause and open Crimson Editor you will not be able to save the original file until you click continue in Xmath. (You will be able to save a backup with a different name) If you want to edit the original mathscript file you must make sure the file is not being executed when you try and make an edit.

Joseph D.
National Instruments
Download All
0 Kudos
Message 2 of 6
(8,315 Views)
I try to do these actions on my PC and the results are like yours. I can save and change the .ms file only after the simulation stopped. Moreover I try to modify the mathscriptwpause.ms during the simulation (meanwhile pause box is waiting the input) with UltraEdit: I can save the file, the editor can not save the backup copy, but the simulation stopped with error after I push the pause button. I'm not able to save the file If I use CrimsonEditor meanwhile the pause button is waiting.

But in my tests all the commands in the macro are done. I have no pause in the .ms file.

Maybe the problem arises from the use of some commands: in the beginning of my .ms files I use 'undefine simexe' and then 'oscmd("del simucb.dll")'. This is done because if I don't dele
te the dll, the program will use the last .dll created and doesn't remake it.

Inside the .ms file there is a call to another file that I have to execute: 'execute file = "Gain_AP.ms"'. This files assigns some values to constants and % variables. I must tell you that I can change this file and save it also after the simulation of the principal file.

I also use these commands:
- getChoice
- set directory (the behaviour is different if I use the Xmath program in NT or in Win2000 O.S. environment)
- stringex
- index
- load file (-> data file saved from another mathscript)
- system
- abcd
- makepoly
- sys2sns

Also I load a block schema with a model and a control system. This schema contains UCB components those link C and Fortran source codes.

Then I execute the 'sim(...)' command, and save the results in some variables:

p1 = plot(t,out(:,1),{....}); etc.

Maybe the sim command lock the .ms file. I don't know.
The behavior is the same in all the macro that contai
ns 'sim(...)' command. Also if I put this command in an other .ms files, that is call by the principal .ms file.

Thanks,
Francesco
0 Kudos
Message 3 of 6
(8,315 Views)
The issue here is related to the sim command. Not all editors are producing the same results, in fact I have not been to see any issue using notepad. However there does seem to be a problem when Crimson is trying to edit a mathscript file that has a sim command. The simexe is staying open after the simulation and Crimson denies access to the file that called simexe. You can use the undefine simexe at the end of your mathscript in order to break this connection. Also you may consider using the remake keyword for the sim command instead of deleting the simucb.dll.
0 Kudos
Message 4 of 6
(8,315 Views)
Thanks,
I'll use the remake keyword in next simulations. (Now I delete the .dll file and the .obj files in the macro that compiles the codes called by UCB).

Some days ago, I tried to undefine simexe after a sim command in the Xmath environment but the file .ms was yet locked. This is a little problem, so I will continue to use UltraEdit.

Bye,
Francesco.
0 Kudos
Message 5 of 6
(8,315 Views)
I have been able to run a mathscript that uses the sim command. I then open Crimson editor and can NOT save the original file. I then run undefine simexe from the xmath command window. I can then save the original file in Crimson editor. This issue is definately related to how the editors open the files. For example notepad does not care if the file is being used by another program so you should never have a problem like this using notepad. However Crimson does not allow access to a file being used. UltraEdit has another method of handling a file already open. I have Crimson Editor so I can recommend using the undefine simexe at the end of your mathscript to free the file for editing.

Joseph D.
National Instruments
0 Kudos
Message 6 of 6
(8,316 Views)