Prev: Recent File List/MatLAB GUI
Next: newline in matlab
From: Richard Wylde on 12 Jul 2010 07:44 Hi there, I have the following: userinput = input('Enter file date (yyyymmdd format): ', 's'); TsonmeanC = dlmread(userinput+'_HiRes.dat',',',0,7); The idea being that, each of my files have a standard date format followed by either _HiRes.dat or some other _xxxxxx.dat. I would like to make it so that my script will execute for any date, defined by the user, rather than having to go through and manually edit each data in the .mat file. Any help is greatly appreciated, Richard.
From: Paul on 12 Jul 2010 08:02 "Richard Wylde" <rwylde(a)gmail.com> wrote in message <i1ev65$ae3$1(a)fred.mathworks.com>... > Hi there, > > I have the following: > > > userinput = input('Enter file date (yyyymmdd format): ', 's'); > TsonmeanC = dlmread(userinput+'_HiRes.dat',',',0,7); > > > The idea being that, each of my files have a standard date format followed by either _HiRes.dat or some other _xxxxxx.dat. I would like to make it so that my script will execute for any date, defined by the user, rather than having to go through and manually edit each data in the .mat file. > > > > Any help is greatly appreciated, > > Richard. I hope I got it right. An example of using the type function for displaying on file: you read a string, let's say: userinpuit = 'yyyymmdd' and you want to add it to a fix sufix: "_HiRes.Dat" than newfile = [userinput '_HiRes.dat']; now you can use the newfile for loading or reading this file.
From: Richard Wylde on 12 Jul 2010 09:05 "Paul " <paul_tutzu(a)yahoo.com> wrote in message <i1f07s$ij0$1(a)fred.mathworks.com>... > "Richard Wylde" <rwylde(a)gmail.com> wrote in message <i1ev65$ae3$1(a)fred.mathworks.com>... > > Hi there, > > > > I have the following: > > > > > > userinput = input('Enter file date (yyyymmdd format): ', 's'); > > TsonmeanC = dlmread(userinput+'_HiRes.dat',',',0,7); > > > > > > The idea being that, each of my files have a standard date format followed by either _HiRes.dat or some other _xxxxxx.dat. I would like to make it so that my script will execute for any date, defined by the user, rather than having to go through and manually edit each data in the .mat file. > > > > > > > > Any help is greatly appreciated, > > > > Richard. > > I hope I got it right. An example of using the type function for displaying on file: > > you read a string, let's say: userinpuit = 'yyyymmdd' and you want to add it to a fix sufix: "_HiRes.Dat" > than > newfile = [userinput '_HiRes.dat']; > now you can use the newfile for loading or reading this file. Thanks, that fixed it. I just did it all in one go: userinput = input('Enter file date (yyyymmdd format): ', 's'); TsonmeanC = dlmread([userinput '_HiRes.dat'],',',0,7);
From: Andy on 12 Jul 2010 09:24 If you do this, then it is up to you to do a whole bunch of validation of the user's input string to make sure that the file name they entered exactly matches an existing file. Have you considered instead using uigetfile? This would be a much more elegant solution.
|
Pages: 1 Prev: Recent File List/MatLAB GUI Next: newline in matlab |