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!