-1

I am new at MATLAB, help me understand this

I googled a lot but I couldn't find a correct answer

Any links will also be helpful

  1. [x, fs] = wavread('bee.wav'); This returns the audio files sampling rate in x

  2. x = x(1000:1480);

    What does this do?

    I know x(:) makes a column vector, but x(a:b); does it make an m * n matrix an n * m?

  • 1
    This is *extremely basic* Matlab. You really shouldn't be using StackOverflow as a substitute for spending a bit of time to learn the language. Before you proceed any further, I suggest that you stop, and go through an introductory tutorial or two. The MathWorks lists [numerous tutorials on their site](http://www.mathworks.com/academia/student_center/tutorials/launchpad.html). Your question is covered in chapter one of the [User Guide](http://mathworks.com/help/pdf_doc/matlab/getstart.pdf) and in the [Getting Started video](http://mathworks.com/videos/getting-started-with-matlab-68985.html). – horchler May 17 '14 at 17:22
  • You can also take a look at the MATLAB tutorial that I provide to first year students. I was a former part-time instructor and MATLAB is used in my department heavily. http://www.ee.ryerson.ca/~rphan/ppt/ELE532_MATLABTutorial_Full.ppt . Unfortunately it's an old PPT from way back when... when I didn't understand the best technologies to use for presentations. I would have done it using LaTeX or `slidify` in `R`. – rayryeng May 18 '14 at 02:27

1 Answers1

2

The command x = x(1000:1480); takes a slice out of a given array and puts it back to x.

These are basics; you should have a look at a good tutorial.

Examples:

a = [1 2 3 4 5];
b = a(2:2:5) % -> [2 4]
c = a(3:end) % -> [3 4 5]
glglgl
  • 89,107
  • 13
  • 149
  • 217