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

조회 수: 2 (최근 30일)
chirag desai
chirag desai 2020년 6월 30일
댓글: Rik 2020년 7월 22일
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