How to Extract Specific Data from Record File for Serial Connection

1 回表示 (過去 30 日間)
B
B 2013 年 5 月 16 日
I would like to extract specific data from a sensor connected to an Arduino UNO, and have it stored for analysis. Using the record function, the probe returns data in this format:
4 < 41 uchar values.
48 75 6d 69 64 69 74 79 3a 20 33 35 2e 30 30 20
25 09 54 65 6d 70 65 72 61 74 75 72 65 3a 20 32
34 2e 30 30 20 2a 43 0d 0a
which equates to
Humidity: 35.00 % Temperature: 24.00 *C
How can I store only the numerical values (in this case 35.00 and 24.00)?

採用された回答

Zoltan
Zoltan 2013 年 5 月 16 日
I had the same problem. I changed the arduino program to have only numbers in two columns.
  1 件のコメント
B
B 2013 年 5 月 17 日
編集済み: B 2013 年 5 月 17 日
That was perfect! Thank you.
I ended up modifying the Arduino code to have only two columns, and then used the following MATLAB code based on this thread to record the data
for i=1:length(x)
y(i) = fscanf(s, '%d%d', 6);
z(i) = fscanf(s, '%d%d', 6);
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by