How do I split a column into a set group? (MATLAB beginner, help would be appreciated).
7 views (last 30 days)
Show older comments
Sandithi Lewanda Pathirannehelage
on 26 Nov 2019
Answered: JESUS DAVID ARIZA ROYETH
on 26 Nov 2019
Hi,
I have a large list of numbers in a column i.e. (5;6;7;8 etc).
I want to split the column into segments where each segment has 60 numbers. Then I want to find the variance of each of those segments and see if its above a particular threshold.(And if its above a threshold then assign 1 into another new list which i have created before hand and have not included here.)
I have made it into a loop as this is what is required.
This is what I have so far:
for k = 1:num_segments
if var(vec_acc_total(:, (60*k)-59:60*k)>threshold
walking_segments_loop(k)=1
else
walking_segments_loop(k)=0
Any help would be appreciated as i am very new to matlab.
THank you!
0 Comments
Answers (1)
JESUS DAVID ARIZA ROYETH
on 26 Nov 2019
solution:
listofnumbers=rand(360,1);%put your list here
threshold=0.08; %your threshold here
walking_segments_loop=(var(reshape(listofnumbers,60,[]))>threshold)' %here your new list
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!