Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Magic and Trace Function

Asked by Pritesh Shah

Pritesh Shah (view profile)

on 14 Sep 2012

Hi, I was amaze to see following output: >> A=[2 3; 4 5]

A =

     2     3
     4     5

>> trace(A)

ans =

     7

>> trace A

ans =

    65

Que: Why am I getting answer of trace A as 65??

(ASCI Value of A is 65)

0 Comments

Pritesh Shah

Pritesh Shah (view profile)

Products

1 Answer

Answer by Wayne King

Wayne King (view profile)

on 14 Sep 2012
Edited by Wayne King

Wayne King (view profile)

on 14 Sep 2012
Accepted answer

That's because the functional form you are using when you enter

 >>trace A

is executing

>>trace('A')

and in this case, it is nothing more than

>>sum('A')

Just like

>>help conv

is the same as

>>help('conv')

0 Comments

Wayne King

Wayne King (view profile)

Contact us