Alamakanambra , '\n' '\n'
, :
y=eye(5)
x=eye(5)
% set m
m = length(x)
% display value of m
fprintf('value of m is: %d', m)
: y = eye (5) :
x=eye(5)
% set m
m = length(x)
% display value of m
fprintf('value of m is: %d', m)
:
x=eye(5)
% set m
m = length(x)
% display value of m
fprintf('value of m is: %d', m)
The solution is to use the CollapseDelimiters property and set it to false in the strsplit method.
You can find the solution here.
This is the complete solution:
currentEditor = matlab.desktop.editor.getActive;
originalSelection =currentEditor.Selection;
row = originalSelection(1)-1;% get row of cursor
C = strsplit(currentEditor.Text,'\n','CollapseDelimiters',false) % Split text of editor by lines
C(row) = [];%remove current row
currentEditor.Text = strjoin(C,'\n');%join it together
currentEditor.Selection = [originalSelection(1)-1 1 originalSelection(1) 0 ];
% make sure cursor is on the same line and on first position
source
share