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:
m-file "cleaning"

Subject: m-file "cleaning"

From: Chris McCorquodale

Date: 10 Jan, 2011 15:09:05

Message: 1 of 8

Hi,

Does anyone know of any useful shortcuts to "cleaning up" m-files? For example If we have spent a while on a FEA model (that we have saved as an m-file) there will be numerous deletes, geometry edits, view changes etc etc resulting in unnecessary lines of matlab code in our m-file and making the solution process significantly more time consuming. Is there any way to simply have these unnecessary lines removed without having to do it ourselves?

Cheers,

Chris

Subject: m-file "cleaning"

From: Husam Aldahiyat

Date: 10 Jan, 2011 15:27:05

Message: 2 of 8

"Chris McCorquodale" wrote in message <igf7eh$97c$1@fred.mathworks.com>...
> Hi,
>
> Does anyone know of any useful shortcuts to "cleaning up" m-files? For example If we have spent a while on a FEA model (that we have saved as an m-file) there will be numerous deletes, geometry edits, view changes etc etc resulting in unnecessary lines of matlab code in our m-file and making the solution process significantly more time consuming. Is there any way to simply have these unnecessary lines removed without having to do it ourselves?
>
> Cheers,
>
> Chris

There are some files on FEX that do that.

Subject: m-file "cleaning"

From: Chris McCorquodale

Date: 10 Jan, 2011 15:54:05

Message: 3 of 8

> There are some files on FEX that do that.

Hi Husam, ignore my ignorance but what is FEX? And where can I find these files? They would save so much time!!

Thanks,
Chris

Subject: m-file "cleaning"

From: Sean de

Date: 10 Jan, 2011 17:42:04

Message: 4 of 8

"Chris McCorquodale" wrote in message <igfa2t$uh$1@fred.mathworks.com>...
> > There are some files on FEX that do that.
>
> Hi Husam, ignore my ignorance but what is FEX? And where can I find these files? They would save so much time!!
>
> Thanks,
> Chris

MATLAB Central's File Exchange.
http://www.mathworks.com/matlabcentral/fileexchange/

Subject: m-file "cleaning"

From: Steven_Lord

Date: 10 Jan, 2011 17:57:16

Message: 5 of 8



"Chris McCorquodale" <c.mccorquodale@axon-cable.co.uk> wrote in message
news:igfa2t$uh$1@fred.mathworks.com...
>> There are some files on FEX that do that.
>
> Hi Husam, ignore my ignorance but what is FEX? And where can I find these
> files? They would save so much time!!

FEX is a commonly used abbreviation for the MATLAB Central File Exchange,
which you can access from the MATLAB Central main page:

http://www.mathworks.com/matlabcentral/

If you're using a relatively new version of MATLAB you can access the File
Exchange from within MATLAB itself.

http://www.mathworks.com/help/techdoc/matlab_env/br2yr0m-1.html


As an aside, since Chris is neither the first nor (likely) the last to ask
this question, perhaps the FAQ should include a section detailing common
abbreviations used in this newsgroup? I'll leave it up to the other gurus
to decide if they want to add such a section and what common abbreviations
should be included.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlab.wikia.com/wiki/FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: m-file "cleaning"

From: Chris McCorquodale

Date: 13 Jan, 2011 09:20:24

Message: 6 of 8

"Steven_Lord" <slord@mathworks.com> wrote in message <igfh9s$crl$1@fred.mathworks.com>...
> FEX is a commonly used abbreviation for the MATLAB Central File Exchange,
> which you can access from the MATLAB Central main page:
>
> http://www.mathworks.com/matlabcentral/
>
> If you're using a relatively new version of MATLAB you can access the File
> Exchange from within MATLAB itself.
>
> http://www.mathworks.com/help/techdoc/matlab_env/br2yr0m-1.html
>
>
> As an aside, since Chris is neither the first nor (likely) the last to ask
> this question, perhaps the FAQ should include a section detailing common
> abbreviations used in this newsgroup? I'll leave it up to the other gurus
> to decide if they want to add such a section and what common abbreviations
> should be included.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlab.wikia.com/wiki/FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com


Hi guys thanks for your answers. I'll get back if I find anything on the file exchange.

Steve - I think that would be a good idea. As someone who has had to get to know matlab quite quickly from scratch, a list of user and general matlab abbreviations would be helpful.

Cheers,

Chris

Subject: m-file "cleaning"

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 13 Jan, 2011 11:03:10

Message: 7 of 8

Chris McCorquodale <c.mccorquodale@axon-cable.co.uk> wrote:

>
> Does anyone know of any useful shortcuts to "cleaning up" m-files? For
> example If we have spent a while on a FEA model (that we have saved as an
> m-file) there will be numerous deletes, geometry edits, view changes etc
> etc resulting in unnecessary lines of matlab code in our m-file and making
> the solution process significantly more time consuming. Is there any way to
> simply have these unnecessary lines removed without having to do it
> ourselves?
>

Implement a revision control system. If you are working on projects alone,
then RCS is good enough. If you are working with others, I suggest
Mercurial, which you can get from http://mercurial.selenic.com/ or for a
Windows friendly version, from http://tortoisehg.org/.

Without revision control, there is a strong tendency to keep old lines of
code within the current file, just in case you want to revert to them.
With revision control, you delete the old, write the new, and check /
commit the new version in. If you don't like it, check out the old version
again. If you want to see the differences between versions, ask the
revision control system to tell you.

If you want some help getting going on this, drop me an email.

--
Dr Tristram J. Scott
Energy Consultant

Subject: m-file "cleaning"

From: Mark Shore

Date: 13 Jan, 2011 14:18:07

Message: 8 of 8

tristram.scott@ntlworld.com (Tristram Scott) wrote in message <igmm5e$frk$1@news.eternal-september.org>...
> Chris McCorquodale <c.mccorquodale@axon-cable.co.uk> wrote:

>
> Implement a revision control system. If you are working on projects alone,
> then RCS is good enough. If you are working with others, I suggest
> Mercurial, which you can get from http://mercurial.selenic.com/ or for a
> Windows friendly version, from http://tortoisehg.org/.
>
> Without revision control, there is a strong tendency to keep old lines of
> code within the current file, just in case you want to revert to them.
> With revision control, you delete the old, write the new, and check /
> commit the new version in. If you don't like it, check out the old version
> again. If you want to see the differences between versions, ask the
> revision control system to tell you.
>
         
Thank you Tristram. Lacking any formal CS training, leaving blocks of commented-out alternate code is exactly what I've been doing. I know this is *not* a good approach but was completely in the dark on where to start.

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