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

 채택된 답변

KL
KL 2017년 8월 17일

0 개 추천

!your_program.exe your_file

추가 답변 (1개)

Hans Jørgen Jensen
Hans Jørgen Jensen 2017년 8월 18일

0 개 추천

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 ?

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

질문:

2017년 8월 17일

답변:

2017년 8월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by