Storing data into a vector from a for loop
显示 更早的评论
I am trying to store data from each iteration into a vector. I cannot seem to figure it out as it will only store the value from the last iteration. I want every value that is above the threshold, which is inputed by the user, to be stored into its own vector.
load sound.dat
t = input('Please enter threshold value:');
n = length(sound);
%Calculations
for v = 1:1:n
if sound(v)>t
x = sound(v);
end
end
Thank you!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Whos 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!