Place a space between executed code

조회 수: 6 (최근 30일)
James Knight
James Knight 2019년 11월 7일
댓글: John D'Errico 2019년 11월 7일
Hi
Whats the best way of placing a psace in the executed code in matlab
EG
userinput= input ('Enter your text here: ')
disp ('');
output=userinput
disp(output)
  댓글 수: 1
John D'Errico
John D'Errico 2019년 11월 7일
Is there something wrong with what you did? (No.) Does it do what you want? (Apparently, yes.) Is it hugely time consuming? (No.)
You will find more benefit in your code from learning to use semi-colons, the lack of which dumps randomly useless stuff onto the command line.
Better yet, your code will benefit from not using tools like input at all. Command line interfaces like that are kludges. Instead, as you learn to use functions and to write them, you will find such an interface is about the worst way to write code.
The point is, you are worrying about if there is a slightly better way to dump a blank line into the command window, when you really need to just learn MATLAB in general. What you wrote does just fine in context.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by