cokedude
cokedude

Reputation: 387

explanation of matlab data types

I'm having trouble understanding the datatypes in matlab. Why does this produce two different datatypes?

data = [25 8 15 5 6 10 10 3 1 20 7]

v = [1:8]

The first one produces a 1x11 double somehow and the second one I believe produces a vector right? How is the first one able to work with findpeaks when the documentation says it wants a vector?

I was trying to do this.

http://www.cyclismo.org/tutorial/matlab/vector.html

Upvotes: 1

Views: 82

Answers (1)

David
David

Reputation: 8459

Typing

data = [25 8 15 5 6 10 10 3 1 20 7]
v = [1:8]
whos

returns

data =
    25     8    15     5     6    10    10     3     1    20     7
v =
     1     2     3     4     5     6     7     8

  Name      Size            Bytes  Class     Attributes

  data      1x11               88  double              
  v         1x8                64  double

so they are both the same, and I'd call them 1x11 vectors of doubles.

Upvotes: 4

Related Questions