Filtering specific variable in 20*380 imported table, like we do in excel.

3 次查看(过去 30 天)
I would like to apply filter to the imported 20*380 line table format excel sheet.
Lets say I have improted excel sheet named 'D" and from this excel sheet I would like to filter 'speed' column like speed ranging from > 2600 and < 2000. and apply this filter to entire excel sheet
now post applying htis filter need to save this excel in matlab with different name and would like to use it further for plotting.
Please suggest the way forward for this operations.
  7 个评论
chirag desai
chirag desai 2020-7-22
model = questdlg (' Select Data file' , 'select',...
'Data','Cancel','c')
switch model
case 'Data'
disp('select Data file')
per=1;
case 'Cancel'
per=2;
end
for R=1:2
if per ==1
[file,path] = uigetfile('*.*',...
'Select One or More Files', ...
'MultiSelect', 'off');
if isequal(file,0)
disp ('User selected cancel');
else
disp(['User selected ', fullfile(file,path)]);
S=readtable([path '\' file]);
break
end
end
if per ==2
Button = buttondlg('Error!','Error','You must select Data file first', ...
struct('Default','Continue','IconString','error'));
switch Button
case 'You must select Data file first'
disp('select Data file')
per=1;
R=R+1;
end
end
end
%% Filtering
S=1800+1000*rand(385,294);
D= S (:,ENG_SPD)<2400 & S(:,ENG_SPD)>2200;
With this line I am facing following Error!!
Error in Data_Trends_Master_Scripts_Rev01 (line 50)
D= S(:,ENG_SPD)<2400 & S(:,ENG_SPD)>2200;
Rik
Rik 2020-7-22
Why are you overwriting S? I created it to have an array to show how you can modify it.
Also, please use the edit tools to format your code properly. I'm on mobile, so I can't easily edit it for you.
For future reference: the only relevant line is the line where you actually load the data: the line with readable. We only need to know you're using that, and to have your file to completely reproduce your problem.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by