save_system on non writable file MATLAB command - matlab

I try to save mdl in old fomart
save_system(fullfile(fullpath, myModel(k).name), fullfile(fullpath, myModel(k).name),'SaveAsVersion', 'R2011b');
I'm getting an error saying that the file I'm trying to save is not writable
how could I make it writable ?
I don't find a similar arg as for copyfile(...'f')
any idea ?
Thanks,

There is a function to modify file attributes:
fname=fullfile(fullpath, myModel(k).name);
fileattrib(fname,'+w');
You could also use java:
fname=fullfile(fullpath, myModel(k).name);
java.io.File(fname).setWritable(true)

Related

KDB generating ERROR:file/path/location/sym os reports: No such file or directory

I am trying to save table as partition using .Q.dpt[hdbroot;.z.d;`tablename].
But it's generating No such file or directory error, but the directory is present.
can you please help me on this.
I have created blank folder to store the data but it's checking for sym file while storing data.
I have created one blank folder and gave that folder path to hdbroot variable, but it's not working.
I could replicate your error by trying to save to a location that doesn't exist on the machine.
q).Q.dpt[`:/does/not/exist;.z.d;`t]
'/does/not/exist/sym. OS reports: No such file or directory
[0] .Q.dpt[`:/does/not/exist;.z.d;`t]
Like I mentioned in my comment, make sure that the hdbroot variable is exactly the location you're expecting. key can help you determine this, here is a quick helper function for you.
q)exists:{"Folder/file ",$[11=abs type key x;"exists";"does not exist"]}
q)exists`:/does/not/exist
"Folder/file does not exist"
q)exists`:/tmp
"Folder/file exists"

Loading file using a path writen in edit box matlab

hello evryone
wanna load file from a specific path writen in an edit box named by 'Load_text', i got the path from the edit box using :
pth=get(handles.Load_text,'string');
then i used 'dir' as follow:
S=dir(fullfile([pth '*.bmp']));
that what cause me an errur . so any ideas ?
If you want to load a file then why you are using dir?
Since you have the file's name, then you can create the fullpath as you do with the fullpath method and check its existence with exists.
If the file exists, then you can load it with all available methods from MATLAB.
Keep in mind that this means that the file is in the same directory as your GUI files. If it is in another then you will have to add it in the fullpath call.
fullpath online doc: http://www.mathworks.com/help/matlab/ref/fullfile.html
exists online doc: http://www.mathworks.com/help/matlab/ref/exist.html

read_grib, where to put ibm2fltmex5.dll

I need to read some Meteological data in grib format. I have download a code which can read the data. but in the middel of code ibm2fltmex5.dll is needed. I have download the dll too from ibm2fltmex5.dll. I have created folders (MeteoLab\Read_GRIB) in (C:\Program Files\MATLAB\R2009a\toolbox) and put the dll in it.I restart my PC but that code error again.
function bds_struct=get_bds(fid,lenbds)
bds=fread(fid,11);
bds_struct.len=lenbds;
bds_struct.oct4=bds(4);
bds_struct.bsfE=int2(bds(5),bds(6));
bds_struct.RefVal=ibm2fltmex5(bds(7:10));
bds_struct.nbits=bds(11);
bds=fread(fid,lenbds-11);
bds_struct.bindata=uint8(bds);
error is
Undefined function or method 'ibm2fltmex5' for input arguments of type
'double'
.
Did I put dll in the correct place? what else should I do?
Any comments is appriciated.
I find another Way, there is a Matlab function which do the same: can be download from :
ibm2flt.m

Allow for non-existent files in FileFieldEditor [duplicate]

I'm setting up a series of preferences in my Eclipse (3.5.2) application and I'm having a problem with the FileFieldEditor. I want to allow the user to specify a log file to print output to. Often, this will be a new file. But when I use the file select dialog with FileFieldEditor, it complains that the file doesn't exists ("Value must be an existing file"). Is there a way, without extending the FileFieldEditor class, to suppress this error and have Java create that file if it doesn't exist? Thanks!
When I look the source code of org.eclipse.jface.preference.FileFieldEditor, the only solution would be to extend it and write your own version of a FileFieldEditor, with:
an overwritten changePressed() method in order to keep the file path even if the file does not exists
an overwritten checkState() method in order to avoid that error message.
So I do not see a way to avoid that FileFieldEditor extension here.

how to connect or load file.dll to matlab?

I want through matlab tutorial but I did not understand it clearly.
Could anyone can explain to me step by step how to load and call .dll functions in matlab?
I tried to use loadlibrary function but I get and error, if anyone can tell we where to put the .dll file and the .h file?
I don't do this often, but i usually do something like:
fullpathToHeader = 'c:\full\path\to\a\header.h';
fullpathToDll = 'c:\full\path\to\a\libraty.dll';
loadlibrary(fullpathToDll, fullpathToHeader);
Then if that works, you can call library functions as:
[outArg1, outArg2, ...] = calllib('library','function',inArg1, inArg2, ...)
See the following link, which contains some problems I encountered and overcame, when trying to load a dll into matlab:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/341602