>> cd(fileparts(editorservices.getActiveFilename))
retourne :
??? Undefined variable « editorservices » or function « editorservices.getActiveFilename ».
Et en effet en R2011a , on a:
>> help editorservices
editorservices not found.
Use the Help browser search field to search the documentation, or
type « help help » for help command options, such as help for methods.
alors que cette même commande en 10b donnait :
>> help editorservices
EDITORSERVICES Summary of Editor services functionality
Programmatically access the MATLAB Editor to open, change, save, or close
documents.MATLAB Version 7.11 (R2010b) 03-Aug-2010
Work with all documents currently open in the Editor:
closeGroup – Close Editor and all open documents.
getAll – Identify all open Editor documents.Work with single document currently open in the Editor:
getActive – Find active Editor document.
getActiveFilename – Find file name of active document.
find – Create EditorDocument object for an open document.
isOpen – Determine whether specified file is open in Editor.Open an existing document or create a new one:
new – Create document in Editor.
open – Open file in Editor.
openAndGoToFunction – Open MATLAB file and highlight specified function.
openAndGoToLine – Open file and highlight specified line.
Do not panic! j’ai remonté ce problème au support technique de The MathWorks le 14 janvier 2011.
Et donc leur réponse lundi 17 janvier 2010 est que le package editorservices a été remplacé par :
matlab.desktop.editor
>> help matlab.desktop.editor
matlab.desktop.editor Summary of Editor Document functionality
Programmatically access the MATLAB Editor to open, change, save, or close
documents.MATLAB Version 7.12 (R2011a Prerelease) 17-Dec-2010
Work with all documents open in the Editor:
isEditorAvailable – Verify Editor is available.
getAll – Identify all open Editor documents.Work with single document open in the Editor:
getActive – Find active Editor document.
getActiveFilename – Find file name of active document.
findOpenDocument – Create Document object for open document.
isOpen – Determine if specified file is open in Editor.Open an existing document or create a new one:
newDocument – Create Document in Editor.
openDocument – Open file in Editor.
openAndGoToFunction – Open MATLAB file and highlight specified function.
openAndGoToLine – Open file and highlight specified line.Work with text from an Editor document:
indexToPositionInLine – Convert text array index to position within line.
positionInLineToIndex – Convert position within line to text array index.
linesToText – Convert cell array of text lines to character array.
textToLines – Convert character array into cell array of text lines.
Donc pour changer de répertoire rapidement à partir de la R2011a, il faut taper:
>> cd(fileparts(matlab.desktop.editor.getActiveFilename))