How to import sensor data in matlab?

4 ビュー (過去 30 日間)
Sheraz Khan
Sheraz Khan 2018 年 10 月 17 日
回答済み: naren 2024 年 3 月 19 日
So I have this data from a sensor. I recently started to learn Matlab. I want to know what is the smartest way to import this data in Matlab because in this data only one column contains four variable time acceleration in x y z. this data is taken at different sampling rates e.g after row 3767 another data starts with different sampling rate. I have no idea where to start. any help would appreciated. thank you in advance

採用された回答

Kevin Chng
Kevin Chng 2018 年 10 月 17 日
編集済み: Kevin Chng 2018 年 10 月 17 日
Hi
The best solution is :
Drag your excel and drop it in MATLAB command window.
It will pop out a app for you to configure your excel input.
startRow = 23;
endRow = 89;
formatSpec = '%14f%20f%21f%f%[^\n\r]';
fileID = fopen('SM-G950F_samsung_dreamltexx.csv','r');
dataArray = textscan(fileID, formatSpec, endRow-startRow+1, 'Delimiter', '', 'WhiteSpace', '', 'TextType', 'string', 'EmptyValue', NaN, 'HeaderLines', startRow-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');
fclose(fileID);
SMG950Fsamsungdreamltexx = table(dataArray{1:end-1}, 'VariableNames', {'Var1','Var2','Var3','Var4'});
clearvars filename startRow endRow formatSpec fileID dataArray ans;
Code above is generated through the application. You may edit the VariableNames yrself in the last two lines.
  1 件のコメント
madhan ravi
madhan ravi 2018 年 10 月 17 日
+1 @Kevin Chng efficient debugger

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

その他の回答 (1 件)

naren
naren 2024 年 3 月 19 日
you can do it by creating a asensor module

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by