Can I update my Matlab behavior
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (2)
Walter Roberson
il 15 Mag 2024
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
il 15 Mag 2024
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.
Vedere anche
Categorie
Scopri di più su Environment and Settings in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!