Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

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

No tags are associated with this thread.

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.

Contact us