Thread Subject: Feature request- "include directories"

Subject: Feature request- "include directories"

From: Igor

Date: 21 Nov, 2009 14:30:28

Message: 1 of 3

Some users prefer to have just one huge project m-file, but as for me, it's more comfortable to have some kind of project tree...
Yet on this way there are some troubles:
1)
Sometimes user has lots of unordered, yet related functions in "project"; just like GUIDE created .m file :
 For now, I have to "manually" add ('.\GUI') to PATH , and manually split initial 'GUI.m' to *.m stored there...
You may agree it can be more convenient to have, for example, '#GUI' folder, where
'#' means it'll be automatically added to path, if it's "visible", just like @-class directories.
Or even '#GUI/#init' & '#GUI/#callbacks' ...
2)
Sometimes there are many jumps from one function to function, or method to method for example(well, quite inefficient, but just to show the thing):

function z=get_2(x,y)
globals g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
z=A.get_1(x + g1*g2*g3*g4*g5*g6*g7*g8*g9*g10 , y);
z=z*2;
end

function z=get_1(x,y)
globals g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
z=A.get(x, y + g1*g2*g3*g4*g5*g6*g7*g8*g9*g10);
z=z+1;
end

...
a=A.get_2(x0,y0);

This can be very slow , and not due to really essential calculations, especially for scalar values... There may be simple solution to add some "#inline" tag to methods, which may make above statements equal to

....
globals g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
t=A.get_1(...
                     x0 + g1*g2*g3*g4*g5*g6*g7*g8*g9*g10,...
                     y0,....
                );
t=t*2;
a=t;

and next step to:

....
globals g1 g2 g3 g4 g5 g6 g7 g8 g9 g10
t=A.get (...
                     x0 + g1*g2*g3*g4*g5*g6*g7*g8*g9*g10,...
                     y0 + g1*g2*g3*g4*g5*g6*g7*g8*g9*g10,....
                );
t_=t_+1;
t=t_;
t=t*2;
a=t;

According to profiler, this may increase performance of some my scripts up to 200%
The only thing is it's quite annoying and to optimize such things manually, also initial code may have much better readability.....

Subject: Feature request- "include directories"

From: Steven Lord

Date: 26 Nov, 2009 22:50:26

Message: 2 of 3


"Igor " <i3v@mail.ru> wrote in message
news:he8ti4$8b1$1@fred.mathworks.com...
> Some users prefer to have just one huge project m-file, but as for me,
> it's more comfortable to have some kind of project tree...
> Yet on this way there are some troubles:
> 1)
> Sometimes user has lots of unordered, yet related functions in "project";
> just like GUIDE created .m file :
> For now, I have to "manually" add ('.\GUI') to PATH , and manually split
> initial 'GUI.m' to *.m stored there...
> You may agree it can be more convenient to have, for example, '#GUI'
> folder, where
> '#' means it'll be automatically added to path, if it's "visible", just
> like @-class directories.
> Or even '#GUI/#init' & '#GUI/#callbacks' ...

Perhaps package directories will suit your needs:

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/brfynt_-1.html

> 2)
> Sometimes there are many jumps from one function to function, or method to
> method for example(well, quite inefficient, but just to show the thing):

I don't understand what you're describing here. If you're talking about
something similar to the C++ "inline" keyword:

http://en.wikipedia.org/wiki/Inline_function

then there isn't really any such thing in MATLAB.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Feature request- "include directories"

From: Igor

Date: 28 Nov, 2009 21:01:03

Message: 3 of 3

"Steven Lord" <slord@mathworks.com> wrote in message <hen0l5$3nj$1@fred.mathworks.com>...
>
> "Igor " <i3v@mail.ru> wrote in message
> news:he8ti4$8b1$1@fred.mathworks.com...
> > Some users prefer to have just one huge project m-file, but as for me,
> > it's more comfortable to have some kind of project tree...
> > Yet on this way there are some troubles:
> > 1)
> > Sometimes user has lots of unordered, yet related functions in "project";
> > just like GUIDE created .m file :
> > For now, I have to "manually" add ('.\GUI') to PATH , and manually split
> > initial 'GUI.m' to *.m stored there...
> > You may agree it can be more convenient to have, for example, '#GUI'
> > folder, where
> > '#' means it'll be automatically added to path, if it's "visible", just
> > like @-class directories.
> > Or even '#GUI/#init' & '#GUI/#callbacks' ...
>
> Perhaps package directories will suit your needs:
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/brfynt_-1.html

Well..I know about it.... I just dislike ‘pack.fnc’ syntax... for use with GUIDE at least-you have to redefine automatically created callbacks...
In fact, of course this is not a huge problem...

>
> > 2)
> > Sometimes there are many jumps from one function to function, or method to
> > method for example(well, quite inefficient, but just to show the thing):
>
> I don't understand what you're describing here. If you're talking about
> something similar to the C++ "inline" keyword:
>
> http://en.wikipedia.org/wiki/Inline_function
>
> then there isn't really any such thing in MATLAB.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>

I was just curious why...this may be quite a simple way to increase performance greatly in many cases...
Anyway, thank you for your answer.

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
directories Igor 21 Nov, 2009 09:34:09
guide Igor 21 Nov, 2009 09:34:09
inline Igor 21 Nov, 2009 09:34:08
rssFeed for this Thread

Contact us at files@mathworks.com