Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading of file problem. 1

Status
Not open for further replies.

vinsen

Mechanical
Feb 15, 2007
19
0
0
Hi,

I have a set of .csv files which i can convert using a converter which i can call thru matlab using dos command,the problem is, i have around 10 files to convert one by one and here is the code i wrote, but i couldnt get it done because in the path for the conversion if i say 's' it doesnt recognise my file name which is suposed to be 'a_1.csv' rather it is searching for s.csv

need your help to solve this problem,

for d = 1:4
s = ['a_' int2str(d) '.csv']
dos('C:\exec\callconverter.exe "C:\Project\s" "C:\Project\s" -C:\Exec\Ascimpconv.dll -IF:"C:\Exec\Project\canape.ini"')
load(s)
end

waiting for your reply,

with kind regards,

vinod.b
 
Replies continue below

Recommended for you

hi,

there is a mistake remove the load(s) command,when i say c:\project\s - s should be a_1.csv and it should fetch this file in the above directory, but it looks for s.csv and it couldnt find anything and it cannot run, so how to solve this problem.

waiting for your reply,

thanks,

vinod.b
 
You missed out single quotes around the s in the dos function and the square brackets to combine the whole string together

Code:
dos(['C:\exec\callconverter.exe "C:\Project\' s '" "C:\Project\' s '" 
-C:\Exec\Ascimpconv.dll -IF:"C:\Exec\Project\canape.ini"'])

M

--
Dr Michael F Platten
 
thank you so much it works fine, now i would like to know how to get the file name.because before running this small script, i will be executing another dos function to split csv files.

here is the function,
dos('C:\Project\splitCSV.exe C:\Project\a.csv 50')

here a is example, but my file names will vary each time,as i cannot load the file in matlab, because it is a csv file,i would like to enquire this file name and store it and then give this name in the above function,

how can i do that,

waiting for your reply,

thanks,
vinod.b
 
hi,

i have used the following code to get the filename,

[fileName,PathName] = uigetfile('*.csv', 'Pick one');
fileandpath = strcat(PathName,fileName);
k = fileName
dos(['C:\Project\splitCSV.exe C:\Project\' k ' 50'])
for d = 1:3
s = [' k_ ' int2str(d) '.csv']
t = [' k_ ' int2str(d) '.mdf']
u = [' k_ ' int2str(d) '.mat']
% Process the contents of the d-th file
dos(['C:\exec\callconverter.exe "C:\Project\' s '" "C:\Project\' t '" -C:\Exec\Ascimpconv.dll -IF:"C:\Exec\Project\canape.ini"'])
dos(['C:\exec\callconverter.exe "C:\Project\' t '" "C:\Project\' u '" -C:\Exec\Matconv.dll -IF:"C:\Exec\Project\canape.ini"'])
end

now for example if my file name is vinod.csv it stores in k as vinod.csv, now i want to take this 'vinod' alone from the string in the K and feed it for s,t,u. so that i could run the file name i want to and not with extension.

how can i do that,

waiting for your replies,

thanks,

vinod.b
 
hi.

thanks for your replies,

i have a command down here where value of e is 200 but when i run this, it is not taking e's value and it isnt working properly can someone guide me why,

dos([['C:\Project\splitCSV.exe C:\Project\' fileName ' e ']])

waiting for your reply,

vinod.b
 
Status
Not open for further replies.
Back
Top