lettura simple

Semicolon in Matlab Commands

When you're using Matlab and you want to speed up the execution of your script, there's a trick you can use. What you do is you put a semicolon at the end of your command, and voilà! Matlab won't print any additional information to the command window, making the execution faster and more memory-efficient.

Now, when you run a command in Matlab, it usually prints some information on the command prompt, such as when you declare a variable.

This happens both when you type a command on the command window and when you run a script.

For instance, when you declare a variable, Matlab prints information about the assignment on the prompt.

>> test=5
test = 5
>>

And that's all well and good if you're only running a few commands. But when you're running a script with many computation operations, it can become quite a hassle.

Every time Matlab prints information to the prompt, it takes up valuable time and memory, slowing down your script and hogging up your computer's RAM.

So, to fix this issue, you can simply add a semicolon at the end of your command.

>> prova=5;
>>

That way, Matlab won't print any information to the prompt, and your script can run more smoothly and efficiently. It's a neat little trick that can save you a lot of time and headache.




Report a mistake or post a question




FacebookTwitterLinkedinLinkedin