how to open datafiles with an exe-file

Hi, I have an exe-file, which converts datafiles in a special format into csv files. To use it, I drag and drop the datafiles on to the exe file, and the exe file converts it, and saves the generated csv in the same folder as the datafile. I would like to generate a script, to do the conversion automatically. Does anyone have an idea how to do this ? Thanks Hans

 Accepted Answer

!your_program.exe your_file

More Answers (1)

Hi again, not sure if I should ask a related question in the same thread, but I'll try. Above I learned how to run a file with an external application. And that works. My next challenge, is to change the destination file so the routine converts one file after another. I worked out the code below, to find the path of the next file in my folder, but the command does not accept it as a valid file name. As an example, it should look like this:
!C:\Users\hjj019\Desktop\DLConverter.exe C:\Users\hjj019\Desktop\CA\TMWMU645.228
where the filename gets updated
Here is what I have:
% Specify data location
dataloc = 'C:\Users\hjj019\Desktop\';
location1 = fullfile(dataloc,'CA');
[M,N] = size(dir(location1)) % Number of datalog files
for i = 1:M
files=dir(location1);
files1=files(M,1)
files2=files1.name
[PATHSTR,NAME,EXT] = fileparts(files2)
files3 = fullfile(location1,[NAME EXT])
% Convert datalog files to CSV
!C:\Users\hjj019\Desktop\DLConverter.exe files3
end
COMMAND WINDOW:
files1 =
struct with fields:
name: 'TMWMU645.228'
folder: 'C:\Users\hjj019\Desktop\CA'
date: '13-jan-2015 09:36:14'
bytes: 25584
isdir: 0
datenum: 7.3598e+05
files2 =
'TMWMU645.228'
PATHSTR =
0×0 empty char array
NAME =
'TMWMU645'
EXT =
'.228'
files3 =
'C:\Users\hjj019\Desktop\CA\TMWMU645.228'
Error: Could not open file files3
So my question is: How can I insert an updating filename in my file conversion command ?

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!