Matlab Tutorial 4: Data Analysis and Statistics with Matlab


As you well can imagine now these formatting codes are very useful and there many others that can be used together with the fprintf command , but there some other commands that use the same formatting codes. Like fscanf can be used to read from text files or textscan that also reads text and converts this to a cell array. See the table below for several format codes.

String Formatting Codes

  • \n New line
  • \r Carriage return
  • \b Backspace
  • \t Horizontal tab
  • \f Form feed
  • %s String of characters
  • %e Exponential notation
  • %f Fixed-point notation
  • %u Decimal notation (unsigned)
  • %g The more compact of %e or %f

On the homepage we have a text file: name.txt. We shall now try to read with the use of command textscan.

>> hist(x,6)

Take a look on the cell array C!

>> y=0:10;

As I have said earlier there are other commands that can do this equally well. Use the Matlab help to find out what other possibilities there are to solve this.

Pages: 1 2 3

  1. cabo San lucas rentals by owner — March 3, 2015 @ 12:27 am

    Thanks for sharing your thoughts about covariance.
    Regards