I have a data set and want to extract rows from the data with same/similar variable name, for which a paricular variable has velues within a range. Example: from a data of temp, humidity, pressure I want to trim out data set which contains humidity and pressure only in the temp range of 30-40 deg C.

 채택된 답변

Akira Agata
Akira Agata 2017년 5월 26일

0 개 추천

You can trim your data by using indexing array idx, as shown below.
% Sample data set
T = array2table(...
[randi([0 50], 100, 1),...
randi([0 100], 100, 1),...
1000+20*rand(100, 1)],...
'VariableNames', {'temp', 'humidity', 'pressure'});
% Trim out humidity and pressure where 30 <= temp <= 40
idx = (30 <= T.temp) & (T.temp <= 40);
Tout = T(idx,{'humidity','pressure'});

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Standard File Formats에 대해 자세히 알아보기

태그

질문:

2017년 5월 26일

댓글:

2017년 5월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by