how to filter using matlab with multiple conditions.??

28 ビュー (過去 30 日間)
sandy
sandy 2014 年 2 月 5 日
編集済み: sandy 2014 年 2 月 11 日
time ch_1 ch_2 ch_3 ch_4
data_20140202_0000 1.00 10.00 12.00 89.00
data_20140202_0112 1.50 30.00 65.00 78.00
data_20140202_1200 4.00 50.00 32.00 87.00
data_20140202_1600 8.00 76.00 12.00 87.00
data_20140202_2304 3.00 32.00 11.00 67.00
i want the whole files which
my condition is ch_1 between 1 to 3 and ch_2 between 10 to 30 ,both should satisfy,
output like this below, which should save in separate excel file
time ch_1 ch_2 ch_3 ch_4
data_20140202_0000 1.00 10.00 12.00 89.00
data_20140202_0112 1.50 30.00 65.00 78.00
  2 件のコメント
Amit
Amit 2014 年 2 月 5 日
what is the data structure? is it array, cell, struct?
sandy
sandy 2014 年 2 月 5 日
its a cell...

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

採用された回答

David Sanchez
David Sanchez 2014 年 2 月 5 日
[data headings] = xlsread('your_file.xls');
ch1=data(:,1);
filt_data1 = find((ch1<=3) & (ch1>=1));
data = data(filt_data1,:);
headings = headings(filt_data1+1,:);
ch2=data(:,2);
filt_data2 = find((ch2<=25) & (ch2>=10));
data = data(filt_data2,:);
headings = headings(filt_data2+1,:);
Now you have your headings and data to write into the xls
  1 件のコメント
sandy
sandy 2014 年 2 月 6 日
編集済み: sandy 2014 年 2 月 11 日
thanks...but how to write in excel with two separate variables (data and heading)...also i have many channels in excel sheet.i am trying to create a GUI code by which if i give .......
INPUT:
1.two channels name
2.min limit and max limit(by which my values between this min &max limits should get as output)
output:
inbetween values with header in separate excel file(its like filtering with multiple conditions)
any ideas ???

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by