Rank: 7051 based on 9 downloads (last 30 days) and 1 file submitted
photo

Sam Johnson

E-mail

Personal Profile:

 

Watch this Author's files

 

Files Posted by Sam Johnson
Updated   File Tags Downloads
(last 30 days)
Comments Rating
21 Sep 2012 Find and replace in selection Find and replace in currently selected editor text. Author: Sam Johnson find, replace, find and replace, strrep, editor, editor api 9 8
  • 5.0
5.0 | 5 ratings
Comments and Ratings by Sam Johnson View all
Updated File Comments Rating
22 Nov 2012 Find and replace in selection Find and replace in currently selected editor text. Author: Sam Johnson

Hi Alina,

you need to pass strings to the function.

i.e: replaceInSelection('median', 'skew')

28 Sep 2012 Find and replace in selection Find and replace in currently selected editor text. Author: Sam Johnson

Sadly there is no associated GUI - you select a region of text in the editor and call the function from the command window.

12 Sep 2012 export_fig Exports figures nicely to a number of vector & bitmap formats. Author: Oliver Woodford

This function is a life saver. I now use it for every publication ready figure as the output is exactly as I see it in MATLAB and sometimes even better!

Thank you.

12 Sep 2012 Figure control widget Intuitive manipulation of a figure using key and mouse gestures Author: Oliver Woodford

This widget is absolutely fantastic - rotation of 3D data is far more intuitive than with the default controls. I no longer visualise any 3D data without it. Thank you.

Comments and Ratings on Sam Johnson's Files View all
Updated File Comment by Comments Rating
09 Nov 2014 Find and replace in selection Find and replace in currently selected editor text. Author: Sam Johnson Meng

02 Jul 2014 Find and replace in selection Find and replace in currently selected editor text. Author: Sam Johnson Anthony

To solve the issue I raised in my last comment, you can simply:

- add the line: numberOfReplacements = numel(strfind(newText(startPos:endPos-1), oldSubstr));

before the line with strrep.

- change the penultimate line for:
[selectionPosition(3) selectionPosition(4)] = matlab.desktop.editor.indexToPositionInLine(activeEditor, endPos+numberOfReplacements*(numel(newSubstr)-numel(oldSubstr)));

01 Jul 2014 Find and replace in selection Find and replace in currently selected editor text. Author: Sam Johnson Anthony

01 Jul 2014 Find and replace in selection Find and replace in currently selected editor text. Author: Sam Johnson Anthony

Excellent! Thanks a lot!

I only have a little comment:
if you replace an expression by a longer expression (e. g. '*' by '.*') part of the selected text is deselected (the number of selected characters remains constant).

It can cause problems if you have to perform several replacements.

It could probably be solved by:
- making the difference (D) of the replacing expression length and the replaced expression length
- extending the selection after replacement of (number of replacement)*D

Anyway thanks a lot for your submission, it's really great :-)

20 Feb 2014 Find and replace in selection Find and replace in currently selected editor text. Author: Sam Johnson Alessandro Masullo

I love you!

Contact us