how do you include new lines in a script - which keyboard tangent?

Answers (2)

Are you asking about a keyboard shortcut to add a blank line to a script file in the Editor? The Enter key is that shortcut. If that's not what you're looking for, please clarify what you want to do.

1 Comment

I have written the below code in matlab and it works without shwoing the iterations but when I add to show the iterations then it crashes, too long lines! So I want to go back into the code and change some lines but I can't get back into the code, it does not allow me to cut into the text.
Ny=10; Nx=10; tol=1d-3; err=1; k=0; u=[2.5 2.3 3 4 5 6 7 8 9 23.1; 1 0 0 0 0 0 0 0 0 -34; 3.4 0 0 0 0 0 0 0 0 12; 1.2 0 0 0 0 0 0 0 0 2.9; 1 0 0 0 0 0 0 0 0 23; 2.4 0 0 0 0 0 0 0 0 -98; -2.7 0 0 0 0 0 0 0 0 8.9; 23 0 0 0 0 0 0 0 0 7.9; 2.8 0 0 0 0 0 0 0 0 6; 2.4 56 67 12 23 2 -4 -8 -9 12]; ukp1=u; while err>tol k=k+1; fprintf(' %4i |',k) for j=2:Ny-1 for i=2:Nx-1 ukp1(j,i)=0.25*(u(j+1,i)+u(j,i+1)+u(j-1,i)+u(j,i-1)); fprintf(' %8.6f |',ukp1(j,i)) end end

Sign in to comment.

I have written the below code in matlab and it works without shwoing the iterations but when I add to show the iterations then it crashes, too long lines!
So I want to go back into the code and change some lines but I can't get back into the code, it does not allow me to cut into the text.
Ny=10;
Nx=10;
tol=1d-3;
err=1;
k=0;
u=[2.5 2.3 3 4 5 6 7 8 9 23.1;
1 0 0 0 0 0 0 0 0 -34;
3.4 0 0 0 0 0 0 0 0 12;
1.2 0 0 0 0 0 0 0 0 2.9;
1 0 0 0 0 0 0 0 0 23;
2.4 0 0 0 0 0 0 0 0 -98;
-2.7 0 0 0 0 0 0 0 0 8.9;
23 0 0 0 0 0 0 0 0 7.9;
2.8 0 0 0 0 0 0 0 0 6;
2.4 56 67 12 23 2 -4 -8 -9 12];
ukp1=u;
while err>tol
k=k+1;
fprintf(' %4i |',k)
for j=2:Ny-1
for i=2:Nx-1
ukp1(j,i)=0.25*(u(j+1,i)+u(j,i+1)+u(j-1,i)+u(j,i-1));
fprintf(' %8.6f |',ukp1(j,i))
end
end

1 Comment

After
for i=2:Nx-1
ukp1(j,i)=0.25*(u(j+1,i)+u(j,i+1)+u(j-1,i)+u(j,i-1));
fprintf(' %8.6f |',ukp1(j,i))
end
add
fprintf('\n');

Sign in to comment.

Categories

Asked:

on 14 Feb 2017

Commented:

on 15 Feb 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!