フィルターのクリア

Finding data off excel sheet

4 ビュー (過去 30 日間)
Luke Radcliff
Luke Radcliff 2016 年 7 月 4 日
コメント済み: Image Analyst 2016 年 7 月 13 日
In the excel sheet attached, the data is 3 different sensors 0,1 and 2(1st column), their voltage(2nd column) and time of the reading(3rd column). I'm struggling to find a way to seperate the full data set into one set of voltage readings and time readings for each sensor. This is what I have
A = xlsread('forcetest.csv');
idx1 = find(A == 0)
I used xlsread just because I think it is easier. I know I have to used the find function, this code I have so far just finds what rows are the censor 0, how to I get it to give me all those rows with the given voltage and time data? Do I have to use a for-loop?
  7 件のコメント
Luke Radcliff
Luke Radcliff 2016 年 7 月 13 日
Yea I can't accept it since its a comment.
Image Analyst
Image Analyst 2016 年 7 月 13 日
Well like I said in my answer it wouldn't have worked anyway since it finds 0's anywhere, not just in column 1.

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

採用された回答

Image Analyst
Image Analyst 2016 年 7 月 5 日
Try this:
A = xlsread('forcetest.csv');
% Extract column 1 which has the sensor IDs.
col1 = A(:, 1);
% Find which rows have value 0, meaning this row is for sensor #0.
sensor0Rows = find(col1 == 0);
% Extract only those rows for sensor #0.
array0 = A(sensor0Rows, :);
% Get voltage and time separately, in case that's wanted.
voltages = A(sensor0Rows, 2); % From column 2
times = A(sensor0Rows, 3); % From column 3
Note that find(A==0) won't work since it finds 0's anywhere, not just in column 1. So if you had a 1 or 2 in column 1 but a 0 in column 2, then it would pick out this row even though it shouldn't.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by