View text in editor without saving to file
1 回表示 (過去 30 日間)
古いコメントを表示
Hi there,
I'm in the process of writing a GUI for my application with a feature of exporting the code to run as an M-file. At the moment the user is prompted for a file location, which is then written to and opened in the editor. However, what I'd like to do is save the text (i.e., code) to a tmp file and pipe this to a new untitled file in the editor without saving it. Does any one know if this is possible / how to do it?
Many thanks!
Nick
0 件のコメント
回答 (2 件)
Jiro Doke
2011 年 2 月 21 日
Depending on the release of MATLAB, you may be able to use the unsupported editor API through the editorservices package.
help editorservices
Here's an example:
editorservices.new(sprintf('data = rand(10,3);\nplot(data);'));
0 件のコメント
Jan
2011 年 2 月 21 日
Undocumented method working in Matlab 2009a, where Jiro's EDITORSERVICES is not available:
S = com.mathworks.mlservices.MLEditorServices;
S.newDocument('Your string here\n2nd line');
Look inside the EDIT function.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!