how to delete a rows with column zeros in excel file

1 次查看(过去 30 天)
Please find the attached excel sheet. In that we have a column from "A to J". out of these i will focus only in column 'C' having zeros in start / end.
My doubt is How to delete all start and end rows with respect to zeros present in column 'C' . suppose column 'C' having zeros in starting and ending, so i need to delete all corresponding rows and saves a new excel file in another location path.
Kindly give a suggestion on this !
here i attached a file "output RPM' and i need like this.
Note:
refer "output RPM" file, In that column 'C', having one zero in start and end of the rows and the remaining rows will be deleted. like this i want . kindly help me
[file,filepath]=uigetfile({'*.csv;*.xlsx;*.xls';},'Select Trajectory Table File(s)','C:\Users\INARUPAR\Desktop\MATLAB WORKOUT\', 'MultiSelect', 'on');
if ~iscell(file)
file = {file};
disp(file)
end
output_file_name = 'output RPM.csv';
column_name = {'Y1'}; % <--- columns name here
fig = figure();
ax = axes();
l = legend(ax);
hold(ax);
ax.ColorOrder = [1 0 0 ; 0 0 1]; % it gives RED Color
drawnow;
for i=1:numel(file)
t = readtable([filepath file{i}],"VariableNamingRule","preserve"); % Read all Data from Selected Excel Sheet
writetable(t(:, column_name),'C:\Users\INARUPAR\Desktop\MATLAB WORKOUT\Check.xlsx' , 'Range', [char(65+numel(column_name)*(i-1)) '1']);
p = plot(t{:, column_name});
l.String(end-numel(column_name)+1:end) = strcat(column_name, '-', num2str(i));
drawnow;
end

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by