Thread Subject: complex function

Subject: complex function

From: Jessica

Date: 9 Sep, 2008 15:15:06

Message: 1 of 3

Hi,

I have a function coded as:

***********************************
function EventLoadSettings(settingsfile)
global settings;
if (nargin < 1) settingsfile=[]; end
[settings settingsfile] = loadsettings(settingsfile);
settings.settingsfile = settingsfile;
[pathstr,name,ext,versn] = fileparts(settingsfile);
settings.basepath = pathstr;
settings.basepath = fixpath(settings.basepath);
addbirdchannels; % converts bird channels in settings files to a useable format

% deal with locmaps
settings.locmappath = [settings.basepath 'locmaps\'];
mkdir(settings.locmappath);

***************************
Rather than having this function open up a folder where I can double-click on my file, I was wondering if there is a way where I can just specify the folder path as well as the specific file that I would normally double-click on when using this function. For example, it would be better if I could type two lines, one indicating the folder path and another indicating the specific file.

Thanks!



Subject: complex function

From: David

Date: 9 Sep, 2008 15:49:02

Message: 2 of 3

"Jessica " <jyorzinski@ucdavis.edu> wrote in message <ga63tq$6fg$1@fred.mathworks.com>...
> Hi,
>
> I have a function coded as:
>
> ***********************************
> function EventLoadSettings(settingsfile)
> global settings;
> if (nargin < 1) settingsfile=[]; end
> [settings settingsfile] = loadsettings(settingsfile);
> settings.settingsfile = settingsfile;
> [pathstr,name,ext,versn] = fileparts(settingsfile);
> settings.basepath = pathstr;
> settings.basepath = fixpath(settings.basepath);
> addbirdchannels; % converts bird channels in settings files to a useable format
>
> % deal with locmaps
> settings.locmappath = [settings.basepath 'locmaps\'];
> mkdir(settings.locmappath);
>
> ***************************
> Rather than having this function open up a folder where I can double-click on my file, I was wondering if there is a way where I can just specify the folder path as well as the specific file that I would normally double-click on when using this function. For example, it would be better if I could type two lines, one indicating the folder path and another indicating the specific file.
>
> Thanks!
>
>
>

somehow what you are saying you want doesn't seem to jive with what is in the code. the code takes a string input apparently representing a file name/path then loads stuff out of the specified file. what specifically are you double clicking on? what do you want to type on the 2 lines, the location of this function .m file or the file name in settingsfile??

Subject: complex function

From: Adam

Date: 9 Sep, 2008 17:22:01

Message: 3 of 3

"David " <dave@bigcompany.com> wrote in message <ga65te$3uj$1@fred.mathworks.com>...
> "Jessica " <jyorzinski@ucdavis.edu> wrote in message <ga63tq$6fg$1@fred.mathworks.com>...
> > Hi,
> >
> > I have a function coded as:
> >
> > ***********************************
> > function EventLoadSettings(settingsfile)
> > global settings;
> > if (nargin < 1) settingsfile=[]; end
> > [settings settingsfile] = loadsettings(settingsfile);
> > settings.settingsfile = settingsfile;
> > [pathstr,name,ext,versn] = fileparts(settingsfile);
> > settings.basepath = pathstr;
> > settings.basepath = fixpath(settings.basepath);
> > addbirdchannels; % converts bird channels in settings files to a useable format
> >
> > % deal with locmaps
> > settings.locmappath = [settings.basepath 'locmaps\'];
> > mkdir(settings.locmappath);
> >
> > ***************************
> > Rather than having this function open up a folder where I can double-click on my file, I was wondering if there is a way where I can just specify the folder path as well as the specific file that I would normally double-click on when using this function. For example, it would be better if I could type two lines, one indicating the folder path and another indicating the specific file.
> >
> > Thanks!
> >
> >
> >
>
> somehow what you are saying you want doesn't seem to jive with what is in the code. the code takes a string input apparently representing a file name/path then loads stuff out of the specified file. what specifically are you double clicking on? what do you want to type on the 2 lines, the location of this function .m file or the file name in settingsfile??
>

this does nothing
if (nargin < 1) settingsfile=[]; end

but if you move that end after you code it makes some sense.

You could hardcode the path:
settingsfile = 'c:\work\school\myfile.m';

You could use dialog boxes:
help inputdlg

you could input from the command prompt:
help input

~Adam

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com