×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Loading of file problem.

Loading of file problem.

Loading of file problem.

(OP)
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

RE: Loading of file problem.

(OP)
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

RE: Loading of file problem.

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

RE: Loading of file problem.

(OP)
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

RE: Loading of file problem.

Have a look at the "dir" function

M

--
Dr Michael F Platten

RE: Loading of file problem.

(OP)
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

RE: Loading of file problem.

Try the "strtok" function

M

--
Dr Michael F Platten

RE: Loading of file problem.

Hi,

use FULLFILE to concatenate PathName and fileName.

And use FILEPARTS to get the file extension.

Jérôme

RE: Loading of file problem.

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources