Extracting data from a given figure?

조회 수: 1 (최근 30일)
Cladio Andrea
Cladio Andrea 2015년 2월 21일
댓글: Geoff Hayes 2015년 2월 21일
Hello everyone, i have a figure as you can see, and what i want is to get x and y coordinates but as you can see i have a data at decimal points what i want to do is to get data from this figure and insert into a 3600x1 array, lets say if i have a data at 258.45 second then i want to have it at 259th row of the matrix, and the seconds that there is no data will be zero inside the matrix, can anyone help me please?

채택된 답변

Geoff Hayes
Geoff Hayes 2015년 2월 21일
Cladio - what is the data that you used to generate the above function? Consider using ceil to round up your seconds to the nearest integer so that you can populate your 3600x1 matrix. For example, if
x = [0.1 12.34 45.32 258.45 1300.2 2501.9 3598.45];
y = [208 231 33 233 162 25 72];
data = zeros(3600,1);
then to populate data with x and y, you could try
data(ceil(x)) = y;
and you will observe that data(259) is 233. The above code assumes that no two packets arrive within the same second (else one will override the other in data).
  댓글 수: 2
Cladio Andrea
Cladio Andrea 2015년 2월 21일
thank you so much!but i am having one error. Subscript indices must either be real positive integers or logicals. because you know for some cases i have '0' inside the x matrix lets say [0,0,0,34.76,0....] and data does not have row 0 do you know how i can fix that? Thank you so much!!!
Geoff Hayes
Geoff Hayes 2015년 2월 21일
Do the zeros correspond to data (packet sizes) that are valid, or should they be ignored?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by