Count rising edge in wave
显示 更早的评论
Hello,
I have the wave data in csv file which contains the time and the corresponding value.
I can plot the wave in matlab to see that it is ok.
However, I would like to count the rising edges of the wave.
I tried using simulink these are the steps I took
1. After CSVread, I saved the data in a .mat file.
2. I tried to read the signal using the 'From File' in simulink.
3. The output of the 'From File' was sent to Scope. (This I did just to make sure I am using the 'From File' correctly)----------It gave me error.
4. I also sent the output of 'From File' to Detect Rise positive----------It gave me error.
Please advice me on what to do to.
NB, I wrote a simple code that counts, but I somehow do not trust myself.
If there are other was of doing it, I would like to know.
Thanks
2 个评论
Star Strider
2015-5-4
Please attach your .mat file. We can’t help unless we know what your data are.
kyin gab
2015-5-4
采纳的回答
更多回答(1 个)
Jonathan
2016-3-16
0 个投票
Star's solution worked a treat for me. Previously I was using a loop to check each bit individually to see if it was less than the subsequent bit, in order to find the index locations corresponding to my clock rising edge times.
The output is almost exactly the same for the two methods, but Star's solution takes a few seconds, as opposed to a few minutes, for my large (10 million sample) data set! Perfect, thanks :)
1 个评论
Star Strider
2016-3-16
As always, my pleasure!
I appreciate your compliment!
类别
在 帮助中心 和 File Exchange 中查找有关 Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!