×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Include lines of code

Include lines of code

Include lines of code

(OP)
Hello ,
 I am an absolute newbie at matlab, and have been tasked with making >10K lines of matlab code user friendly. This is incredibly spaghetti code and has a ton of settings changing in different arbitrary places. One way of making this more userfriendly that was suggested was to use separate files for each of the settings/variables  and call these files every time i need those values.
I would like to know if there is a way to open a text file and essentially 'cut and paste' all its contents at a particular location in a .m file at execution time?

RE: Include lines of code

Hi,
You can't normally, edit matlab code at execution time. If you are using the editor/debugger you can do copy and paste to another file, but can't cut out parts of the running program.
The best thing to do is to write down the lines numbers to cut out and do the cutting after the session end.

Joe
BSTEX - Equation viewer for Matlab
http://www.geocities.com/bstex2001

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources