Count rising edge in wave
Afficher commentaires plus anciens
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 commentaires
Star Strider
le 4 Mai 2015
Please attach your .mat file. We can’t help unless we know what your data are.
kyin gab
le 4 Mai 2015
Réponse acceptée
Plus de réponses (1)
Jonathan
le 16 Mar 2016
0 votes
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 commentaire
Star Strider
le 16 Mar 2016
As always, my pleasure!
I appreciate your compliment!
Catégories
En savoir plus sur Transforms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!