matlab print to console

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Say I had a variable called » x » and x=5 .

I would like to do:

and have that code print:

x is equal to 5.

This is how I am used to doing things in Java, so their must be a similar way to do this in MATLAB.

3 Answers 3

If you want to use disp , you can construct the string to display like so:

I personally prefer to use fprintf , which would use the following syntax (and gives me some control over formatting of the value of x)

You can, of course, also supply x as string, and get the same output as disp (give or take a few line breaks).

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Оцените статью
Добавить комментарий

Adblock detector