Just works
Sunday, September 27, 2009
Wednesday, September 23, 2009
Copy File using command/script in Matlab
This one comes handy when you have repetitive work to copy the files to some directory.
I had to conduct different tests with different parameters and hence wanted an automated way to clean up the files after each test. I wanted to have them organized in folder as per attribution.
This is quite stunning to realize that Matlab has unix features such as ls and pwd
while not cp or mv for copying the files. I started by assuming that cp or mv should work. It does not!
After I copy the files, I can:
I had to conduct different tests with different parameters and hence wanted an automated way to clean up the files after each test. I wanted to have them organized in folder as per attribution.
This is quite stunning to realize that Matlab has unix features such as ls and pwd
while not cp or mv for copying the files. I started by assuming that cp or mv should work. It does not!
After I copy the files, I can:
delete('Untitled.m')
%%%%%%%%%%%%%%%%%%%%%%%%%%-------------%%
function clean_up_fig
jj = 'test';
%%
cd G1_OK
mkdir(jj)
copyfile('*.fig',jj)
copyfile('*.tif',jj)
copyfile('*.mat',jj)
delete('*.tif')
delete('*.fig')
cd ..
%%%%%%%%%%%%%%%%%%%%%%%%%%-------------%%
function clean_up_fig
jj = 'test';
%%
cd G1_OK
mkdir(jj)
copyfile('*.fig',jj)
copyfile('*.tif',jj)
copyfile('*.mat',jj)
delete('*.tif')
delete('*.fig')
cd ..
Sunday, September 20, 2009
Get desired elements from the given array in Matlab
A very simple function to collect the items from the array which meets the required condition
Subscribe to:
Posts (Atom)