MATLAB Answers

Specifying a sample of data from a table

1 view (last 30 days)
g_co on 13 Oct 2021
Edited: Dave B on 13 Oct 2021
I am trying to find how to specify a section of data to be analysed by a certain function. What is the method of doing so?
I'm currently using the circ_r and circ_std function kindly created by Philipp Berens available at, in order to analyse wind direction data.

Answers (1)

Dave B
Dave B on 13 Oct 2021
Edited: Dave B on 13 Oct 2021
This sounds like a pretty broad topic, how to index things in MATLAB.
You might be interested in this documentation page about indexing:
Here's some example code that calls circ_r with various subsets of an arbitrary theta
theta = [pi/3 pi/2 pi/5 2*pi];
circ_r(theta) % all theta
circ_r(theta(1:3)) % first three theta
circ_r(theta([1 4])) % first and fourth theta
circ_r(theta(end-1:end)) % last two theta
circ_r(theta(theta<pi/2)) % first and third theta
circ_r(theta(1:2:end)); % first and third theta
a = [1 2 3 4];
circ_r(theta(a>2)) % last two theta
circ_r(thata(a==1 | a>2)) % first, third, and fourth theta
If your data are in a table things are pretty similar:
% etc

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by