필터 지우기
필터 지우기

how retrive last data not nan from Thingspeak channel in matlab

조회 수: 8 (최근 30일)
Ahmed Mansour
Ahmed Mansour 2024년 6월 12일
답변: Aditya 2024년 6월 27일 9:16
I want in my project when retrive data from Thingspeak channel and if data is nan then retrive last data not nan in matlab

답변 (1개)

Aditya
Aditya 2024년 6월 27일 9:16
Hi Ahmed,
Thank you for reaching out.
To retrieve data from a ThingSpeak channel, you can refer to the example "Retrieve Recent Data with Its Timestamp" on the MathWorks documentation page: Retrieve Recent Data with Its Timestamp.
Similar to the example provided, you can retrieve data from your ThingSpeak channel. Once you have the data, you can use the 'find(~isnan(data))' function to identify the indices of non-NaN values. Then, you can use these indices to locate the last non-NaN value in the required column.
Here’s a brief outline of the steps:
  1. Retrieve Data: Use the thingSpeakRead function to read data from your ThingSpeak channel.
  2. Identify Non-NaN Values: Apply the 'find(~isnan(data))' function to get the indices of non-NaN values.
  3. Get the Last Non-NaN Value: Use the indices obtained to find the last non-NaN value in the data.
Note that if you want to retrieve the end index for a particular column, you need to use indexing in the data array to specify that particular column.
I hope it helps!

카테고리

Help CenterFile Exchange에서 Prepare and Analyze Data에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by