Code covered by the BSD License  

Highlights from
replaceTildes

1.0

1.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 1.87 KB File ID: #42403

replaceTildes

by

 

27 Jun 2013 (Updated )

Recurses through directories, finding Matlab code and replacing LHS tildes with 'ans'.

| Watch this File

File Information
Description

Recurses through directories, finding Matlab code and replacing LHS tildes with 'ans' to make code backwards compatible.

WARNING: this overwrites files!!! Copy the whole folder before use!!!

Please report bugs on the Matlab FX.
And if you can come up with a better regex let me know.

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
28 Jun 2013 Jos (10584)

I am currently rating this as one star because it should not overwrite files by default! This is potentially very dangerous.

You should copy the directory, and make the changes in the copied files. If this is implemented, I will reconsider my rating. The idea is fine btw ...

28 Jun 2013 Jan Simon

I recommend not to overwrite the automatically accessed "ans" variable. This can be confusing e.g. during debugging. I'd use something like "dummy" instead.

The function is useful to support Matlab versions <= 2009a. The help text does niot have a H1-line, but is clear and contains the required warning. Perhaps a dialog might be added to ask for a confirmation. I cannot test the robustness of the REGEXP currently, such that I do not dare to rate this submission yet.

Btw. the need to include a subfunction to obtain a recursive list of files in subfolders is shows, that TMW should urgently include this as a toolbox function. This is a standard task which should not be left to the users.

Updates
01 Jul 2013

Added warning dialogue at top of function. And explicitly declared DUMMY_VAR_NAME for user to change at his/her discretion.

Contact us