Convert Data from array

조회 수: 1(최근 30일)
David Jones
David Jones 2020년 9월 22일
댓글: Star Strider 2020년 9월 24일
I have attached a Jpeg of my data file displayed in a plot,(0 to 80mS) it shows exactly the data I need how do I convert this data to a new array as is in the plot. The actual array use to create the plot has 16000 samples at 5uS per sample which is of no interest .I just need the 1s and 0s as the plot along with there timing and not 16000 1s and 0s
Thank you for any help

채택된 답변

Star Strider
Star Strider 2020년 9월 22일
I am not certain what your data are, or what you want to do.
One option for reducing the size of the array and still getting the plot is to use the find function to detect the 1 and 0 levels, and simply store them. Use the stem function to plot them. Another (likely more robust) option is to use the Signal Processing Toolbox midcross function to detect the pulses.
The find function might return something like this:
idx = [1 5 6 9 21 23 30 35 40];
that you could then plot as:
stem(idx, ones(size(idx)), 'Marker','none')
  댓글 수: 8
Star Strider
Star Strider 2020년 9월 24일
I honestly have no idea how best to do that.
Try this:
D = load('mandecode.mat');
y = D.manchesterDecoded;
st = [1 strfind(y, [0 1])];
en = strfind(y, [1 0]);
sten = sort([st en]);
dsten = diff([0 sten]); % <— This May Be What You Want
bitlen = min(dsten);
histogram(dsten, 2*numel(st))
plot(y, 'LineWidth',1.5)

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Ameer Hamza
Ameer Hamza 2020년 9월 22일
It seems that you want to reduce the number of samples. For your data, a good option seems to be decimate():
  댓글 수: 5
David Jones
David Jones 2020년 9월 23일
Thank you for your help

댓글을 달려면 로그인하십시오.


Community Treasure Hunt

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

Start Hunting!

Translated by