Extracting ranges of data from a column

18 views (last 30 days)
Sarahtxtr8
Sarahtxtr8 on 15 Jun 2022 at 12:57
Commented: Sarahtxtr8on 15 Jun 2022 at 13:23
Hello,
I am very new to matLab and I am trying to separate various speeds into new columns. I am having a hard time figuring out how to extract the various data points that correspond to the approriate zones. With the last line of code I am getting the error of "Brace indexing is not supported for variables of this type."
Any help is greatly aprreciated.
copydata from excel into new variable entitled SpRaw
Speed=downsample(SpRaw,10);
SpLen=length(Speed);
% Determine Time array
fori=1:1:SpLen
Time(i,1)=i*0.1;
end
% Grouping speed and time into appropriate zones
% zone 1, standing (0 m·s−1),
% zone 2, walking (1.67 – 2.1 m·s−1),
%区3,jogging (2.2 – 3.30 m·s−1),
% zone 4, low-speed running (3.31 – 4.13 m·s−1),
% zone 5, moderate-speed running (4.14 – 4.97 m·s−1),
% zone 6, high-speed running (5 – 6.92 m·s−1),
% zone 7, sprinting (> 6.93 m·s−1)
% Extract rows from Speed if value in column1 is between value1 and value2
rows = Speed{:, 1} > 1.67 & Speed{:, 1} < 2.1;
2 Comments
Sarahtxtr8
Sarahtxtr8 on 15 Jun 2022 at 13:23
That worked. Thank you so much for the help.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 15 Jun 2022 at 13:04
Speed is not a table or cell array. Try using parentheses instead of braces.
rows = Speed(:, 1) > 1.67 & Speed(:, 1) < 2.1;

Community Treasure Hunt

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

Start Hunting!

Translated by