hamaney
hamaney

Reputation: 498

MATLAB resulted MTX format

So.. I am writing this function in MATLAB but I don't like the result's format where MATLAB factors a constant out of the returned MTX.

The number I am looking for is 0.7584 as the second element in the returned MTX. However the result was displayed as

1.0e+04 * [2.0059 0.0001 0.0004].

I asked for the second element in the result and it was the value I wanted.

The question is: how can I make the function/MATLAB display the result as a MTX only without timing it with that constant. any thoughts ?

Click here to see the screenshot 1

Upvotes: 0

Views: 54

Answers (1)

Jørgen
Jørgen

Reputation: 863

You can use format to set the output style of the command window.

>> a = rand(1, 3)*10e-4;
>> format short
>> disp(a)
   1.0e-03 *

   0.9649    0.1576    0.9706
>> format longe
>> disp(a)
   9.648885351992765e-04     1.576130816775483e-04     9.705927817606157e-04

Try out the different options to find what suits you.

Upvotes: 1

Related Questions