newbieDevloper
newbieDevloper

Reputation: 191

extra lines in command window output

I am very new to MATLAB and i am currently trying to learn how to import files in matlab and work on it. I am importing a "*.dat" file which contains a single column of floating point numbers[they are just filter coefficients I got from a c++ code] into an array in MATLAB. When I am displaying the output in command window the first line is always " 1.0e-03 * " followed by the contents of my file. I want to know what it means? When I check my workspace the array connects the correct number of inputs. My sample code and first few lines of output are below:

Code:-

clear; clc;

coeff = fopen('filterCoeff.dat');

A = fscanf(coeff, '%f');    

A

fclose(coeff);

Output:-

A =

   **1.0e-03 ***   <===== What does this mean?

  -0.170194000000000

                   0
   0.404879000000000

                   0
  -0.410347000000000

P.S: I found many options to read file eg. textscan, fscanf etc. Which one is the best to use?

Upvotes: 1

Views: 46

Answers (2)

Aero Engy
Aero Engy

Reputation: 3608

I think it is is just Matlab's display number type. It means each of your results are scaled by that amount.

format longg
A

And see what it displays. Look at the docs for format for other options.

Upvotes: 0

Luis Mendo
Luis Mendo

Reputation: 112679

It is a multiplier that applies to all the numbers displayed after that. It means that, for example, the last entry of A is not -0.410347 but -0.410347e-3, that is, -0.000410347.

Upvotes: 1

Related Questions