programming for data processing

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.

 采纳的回答

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 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by