I am creating a .dat file with headers and data in Matlab, however when I try opening it from the folder where it is saved then I get the error that says 'file in use by another application and cannot be accessed'. This error occurs even when Matlab is closed. I can only open it as a text by right clicking on the file through the Matlab's current directory window. Why is this happening and how to resolve it?
You could try:
fclose('all')
to close all open files.
This is not supposed to happen, and, in fact, doesn't happen when I try your code on my machine (OS X, R2010a). In other words, I strongly doubt that there is any problem with the Matlab code.
Try restarting Windows, then the problem should go away for newly created, differently named files.
Related
Which is the final outcome of the VScode [issue] #14298 (https://github.com/microsoft/vscode/issues/14298) ?
Is it: "No, we will NOT issue a warning, if an external app modifies a VScode opened file, like ALL other editors do ? (except Notepad)"
Up to now, I cannot find such a setting...
I have never seen a prompt when an open file is changed elsewhere. What I have seen is a warning when I try to save a file that has been changed elsewhere. I have seen this: preventing dirty writes
VS Code will show you an error message when you try to save a file
that cannot be saved because it has changed on disk. VS Code blocks
saving the file to prevent overwriting changes that have been made
outside of the editor.
In order to resolve the save conflict, click the Compare action in the
error message to open a diff editor that will show you the contents of
the file on disk (to the left) compared to the contents in VS Code (on
the right):
Until those issues have been resolved I believe that is as close as you are going to get.
I have received a simulink model from one of my students, but as he is using a newer version of MATLAB (8.6) than the one i have installed (8.5) i get an error when i try to open it.
How can i open it without asking him to save in an older format?
If you have a .slx file that you need to convert, the process is a little different. Using a tool like 7Zip, open the .slx file (a .slx is really just a disguised .zip file) so you can edit it without extracting all the files. Go into the "metadata" folder. Edit each of the .xml files in there and change the tags for <cp:version> and <matlabVersion>. Save each and have 7Zip update the archive for you.
Like the other responder said though, if you used any part of your model uses features inherent to the newer version, those components will be broken.
It was actaully quite simple.
I opened the .mdl file in a text editor and search/replaced
8.6->8.5
and 2015b->2015a
Sometimes when doing this an error occurs when opening a model for the first time. After saving it the first time and reopening it this error dissapears.
It should however be noted that if the model contains a new component or if the functionality of a component has been changed this method will not work.
Sigurd
I am new to matlab and I've installed it successfully. Everything works fine. But when ever I try to open .m files, I always get following error popping out of dialog box:
Error using open(line 162)
Failed to open matlab editor.
And in command window it throws a lot of Java exceptions.
First of all please forgive my poor English.
I've been searching for this problem all over the internet but couldn't find any useful solution.
I'm using windows 8.1 pro 64-bit os.
Your error message indicates that there is an error in a line that justs consists of
<br>
This is not valid matlab code (looks more like html). As such it seems like you have either messed up the open function, or overloaded it somehow.
I think the first thing to do is check which open and see where this points you.
If this does not help, try to look at the matlab path carefully and see whether you accidentally added a (html?) file on it called open.m.
Lastly, you could try to use the built in open function directly, check doc builtin for this. If you succeed at least you are sure it is not a matter of corrupting the standard file.
I have a script named my_script.m, which has been mistakenly replaced by another file with the same name. However, prior to overwriting the script, I have run it in MATLAB console. Hence, I have the following history.
>> my_script
>>
Is there any way to recover that history file?
The reason why I think it is still possible is that I do have the run history of that script in my current console. If only I had selected all the script and run it! That way I would have every command in the console history. But now, it is simply one line as above.
Check if you had diary mode on, then everything is there:
get(0,'Diary')
You can open the file in windows explorer, right mouse button, properties. Then check if there are any other versions of the file in the Previous Versions tab ;)
Sometimes matlab writes backups, the file would be named my_script.asv. Check if it exists, it's located in the same directory.
I just want to view the contents of the file. It's in a directory, which I have access to. Is there a Unix command to view the contents of it? I can also load it in MATLAB. Is there a similar MATLAB command?
Thanks
To load myFile.mat from your home directory, start Matlab and call
load ~/myFile.mat
This loads the file into your workspace, and lets you inspect its contents.
If you have a more recent version of Matlab, you can also click on it in Matlab's directory browser, beneath which you see a preview of the contents (e.g. the variables it contains). Also, double-clicking on the file in Matlab's directory browser opens an import dialog.
Since more recent versions of Matlab save files in hdf5 format, you can open the file from the Unix commmand line with any tool that is capable of reading that format. However, opening it in Matlab is usually the more convenient option.