Hi,
I was wondering if someone could help me out with a minor problem. I have the following portion of a much larger script (see below). My problem occurs when I enter a 1,8, or 9, which correctly runs another script. The issue arises when the other script ends, and it reverts back to the script below and then continues with this main script. How do I get it to simply stop running once it completes the seperate script for the values 1, 8, or 9? I thought by using the 'return' it would do that particular job, but not the case.
i = input('Enter the profile name for analyses > ');
if i==1
run Newport_PlotEDA_pr1
return
elseif i==8
run Newport_PlotEDA_pr8
return
elseif i==9
run Newport_PlotEDA_pr9
return
end
fname=sprintf('newport%d_EDA-B.txt',i);
cd ('C:\DATA\DOGAMI_projects\OBSMAP\Beach_profiles\Newport\EDA')
EDA = csvread(fname); %load excursion distance data
ddate = load('newport_EDA_time.txt'); %load time data
yy = ddate(:,1);
mm = ddate(:,2);
dd = ddate(:,3);
time = datenum(yy,mm,dd); %convert time data to matlab format
Many thanks
Jon
|
|
0
|
|
|
|
Reply
|
Jonathan
|
9/16/2010 4:07:07 PM |
|
"Jonathan" <jkakiwi@yahoo.co.uk> wrote in message <i6tfbb$d31$1@fred.mathworks.com>...
> Hi,
> I was wondering if someone could help me out with a minor problem. I have the following portion of a much larger script (see below). My problem occurs when I enter a 1,8, or 9, which correctly runs another script. The issue arises when the other script ends, and it reverts back to the script below and then continues with this main script. How do I get it to simply stop running once it completes the seperate script for the values 1, 8, or 9? I thought by using the 'return' it would do that particular job, but not the case.
>
> i = input('Enter the profile name for analyses > ');
> if i==1
> run Newport_PlotEDA_pr1
> return
> elseif i==8
> run Newport_PlotEDA_pr8
> return
> elseif i==9
> run Newport_PlotEDA_pr9
> return
> end
> fname=sprintf('newport%d_EDA-B.txt',i);
> cd ('C:\DATA\DOGAMI_projects\OBSMAP\Beach_profiles\Newport\EDA')
> EDA = csvread(fname); %load excursion distance data
> ddate = load('newport_EDA_time.txt'); %load time data
> yy = ddate(:,1);
> mm = ddate(:,2);
> dd = ddate(:,3);
> time = datenum(yy,mm,dd); %convert time data to matlab format
>
>
> Many thanks
> Jon
You could put all of the statements after the end into a non-conditional else statement so that once the program is done (w/ 1 8 9) nothing else is called. I.e:
> i = input('Enter the profile name for analyses > ');
> if i==1
> run Newport_PlotEDA_pr1
> return
> elseif i==8
> run Newport_PlotEDA_pr8
> return
> elseif i==9
> run Newport_PlotEDA_pr9
> return
else
> fname=sprintf('newport%d_EDA-B.txt',i);
> cd ('C:\DATA\DOGAMI_projects\OBSMAP\Beach_profiles\Newport\EDA')
> EDA = csvread(fname); %load excursion distance data
> ddate = load('newport_EDA_time.txt'); %load time data
> yy = ddate(:,1);
> mm = ddate(:,2);
> dd = ddate(:,3);
> time = datenum(yy,mm,dd); %convert time data to matlab format
end
|
|
0
|
|
|
|
Reply
|
Sean
|
9/16/2010 4:17:19 PM
|
|
"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i6tfuf$m9d$1@fred.mathworks.com>...
> "Jonathan" <jkakiwi@yahoo.co.uk> wrote in message <i6tfbb$d31$1@fred.mathworks.com>...
> > Hi,
> > I was wondering if someone could help me out with a minor problem. I have the following portion of a much larger script (see below). My problem occurs when I enter a 1,8, or 9, which correctly runs another script. The issue arises when the other script ends, and it reverts back to the script below and then continues with this main script. How do I get it to simply stop running once it completes the seperate script for the values 1, 8, or 9? I thought by using the 'return' it would do that particular job, but not the case.
> >
> > i = input('Enter the profile name for analyses > ');
> > if i==1
> > run Newport_PlotEDA_pr1
> > return
> > elseif i==8
> > run Newport_PlotEDA_pr8
> > return
> > elseif i==9
> > run Newport_PlotEDA_pr9
> > return
> > end
> > fname=sprintf('newport%d_EDA-B.txt',i);
> > cd ('C:\DATA\DOGAMI_projects\OBSMAP\Beach_profiles\Newport\EDA')
> > EDA = csvread(fname); %load excursion distance data
> > ddate = load('newport_EDA_time.txt'); %load time data
> > yy = ddate(:,1);
> > mm = ddate(:,2);
> > dd = ddate(:,3);
> > time = datenum(yy,mm,dd); %convert time data to matlab format
> >
> >
> > Many thanks
> > Jon
>
> You could put all of the statements after the end into a non-conditional else statement so that once the program is done (w/ 1 8 9) nothing else is called. I.e:
>
> > i = input('Enter the profile name for analyses > ');
> > if i==1
> > run Newport_PlotEDA_pr1
> > return
> > elseif i==8
> > run Newport_PlotEDA_pr8
> > return
> > elseif i==9
> > run Newport_PlotEDA_pr9
> > return
> else
> > fname=sprintf('newport%d_EDA-B.txt',i);
> > cd ('C:\DATA\DOGAMI_projects\OBSMAP\Beach_profiles\Newport\EDA')
> > EDA = csvread(fname); %load excursion distance data
> > ddate = load('newport_EDA_time.txt'); %load time data
> > yy = ddate(:,1);
> > mm = ddate(:,2);
> > dd = ddate(:,3);
> > time = datenum(yy,mm,dd); %convert time data to matlab format
> end
Thanks Sean, this worked.
|
|
0
|
|
|
|
Reply
|
Jonathan
|
9/16/2010 4:32:21 PM
|
|
|
2 Replies
358 Views
(page loaded in 1.442 seconds)
Similiar Articles: ending a script - comp.soft-sys.matlabHi, I was wondering if someone could help me out with a minor problem. I have the following portion of a much larger script (see below). My problem ... Expect scripting on HP - help please - comp.sys.hp.hpuxending a script - comp.soft-sys.matlab Expect scripting on HP - help please - comp.sys.hp.hpux ending a script - comp.soft-sys.matlab Expect scripting on HP - help please ... how to force matlab to quit a running script - comp.soft-sys ...ending a script - comp.soft-sys.matlab... script below and then continues with this main script. How do I get it to simply stop running ... Premature end of JPEG file ... goto in expect scripts - comp.lang.tclending a script - comp.soft-sys.matlab... sys.hp.hpux ending a script - comp.soft-sys.matlab Expect scripting on HP - help please - comp.sys.hp.hpux ending a script ... Printing from field 14 to end of record - comp.lang.awkending a script - comp.soft-sys.matlab Printing from field 14 to end of record - comp.lang.awk Hi I have a field with 5 radio buttons. I ... Add an Exit Record script step ... Premature end of JPEG file - comp.soft-sys.matlabI am running a script to load in some jpegs from an ultrasound scanner. When I load in the file using imshow I get the following warning: Warning: Premature end of ... How to set DISPLAY env. in script. - comp.sys.sun.adminSetting Environment Variable for ssh ForwardX11 Session - comp ..... does not help so I end up creating a script ... profile command-to-invoke-X-display With your help ... mail command automated in a script - comp.unix.solaris... system, attach a log file to it, > everytime this script is run, towards the end of it > > mail a1@a1.com, a2@a1.com, b2@b1.com > > how to include this in the script, i ... How to set the cursor to the end of a input box? - comp.lang ...... am using the middle function to extract the text but the cursor is always at the end. I want the user input ... Thanks in advance, > > Peter Only in FM7: Script step: Set ... Automatically Mail PDF Script - comp.databases.filemaker ...I modified the MailAsPDF script (see below ... window to activate the AttachAsPDF script automatically. I > know it is only saving two button clicks, but in the end I ... [Tutor] Ending a script - mail.python.org Mailing ListsOn Wednesday 06 February 2008 09:23, Damian Archer wrote: > When I am running a script in cmd the script runs but the cmd windows > closes immediately after the ... A Movie Script Ending - Wikipedia, the free encyclopedia"A Movie Script Ending" is a song by American indie rock band Death Cab for Cutie, and the first single release from the band's third studio album, The Photo Album. 7/22/2012 3:00:15 AM
|