Can I update my Matlab behavior
2 ビュー (過去 30 日間)
古いコメントを表示
Sorry for the poor title, not sure how to explain it.
I have two questions:
1) When we write three dots to split a command line, can we change what happens?
examplepath = 'this\is\a\path\'; % This is a random string
examplepath = ['this\is\a\...' ...
'path\']; % this is the same string if I write three dots "..." somewhere
% This is a bad behavior because it breaks the string
%% What I want Matlab to do when I write three dots:
examplepath = ['this\is\a\', ...
'path\'];
This is what I want to do when I write three dots and press enter, I want to split whatever I wrote so it fits on 2 lines and I don't have to use the horizontal slider bar because my sentence is too long. Is it be possible to update such behavior?
2) Indentation changed a few versions ago, I now use 2023a.
If I have a loop for example, when I paste code to it, I want it to be indented where it should be by default, not at the begining of the line. Example:
for i = 1:10
% something I wrote here here
% someting I pasted
end
%% It should be:
for i = 1:10
% something I wrote here here
% someting I pasted
end
It would be great to save these selection + ctrl+i, clicking at a random place inside a loop before was giving you an indented space, I want the same behavior.
Thanks!
0 件のコメント
回答 (2 件)
Walter Roberson
2024 年 5 月 15 日
In the MATLAB editor, if you start with
examplepath = 'this\is\a\path\'
and position your cursor at the path part and press return, then MATLAB will automatically split it into
examplepath = ['this\is\a\' ...
'path\']
Image Analyst
2024 年 5 月 15 日
Sometimes when pasting text in the indentation in the course was a mixture of tabs and spaces so the alignment is off.
To fix the indenting, have the cursor in the editor window and type control-a and then control-i.
I don't understand what you mean when you're manually breaking up a long string by typing an apostrophe, three dots, and then enter etc. I don't know of any function (keystroke shortcut) to take your long string and break it into multiple lines automatically.
参考
カテゴリ
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!