Friday, April 12, 2013

Change the format for displaying numbers in Matlab's workspace

By default, Matlab shows in its workspace and at the command line numbers in a format that may not be suitable in all cases, e.g., when you have a large number of decimal digits.
The format of the number display can be changed by the built-in command

format Style

where Style indicates different formats.
See the Help page of the format built-in command for its syntax and the list of possible formats.

Import data into Matlab from an ASCII text file

A quick intro about the different built-in functions available in Matlab for importing data from an ASCII text file can be found at

http://www.mathworks.ch/ch/help/matlab/import_export/ways-to-import-text-files.html

The importdata function is particularly useful.