How to take out blank rows from a result table?
Show older comments
I currently have a code that calculates specific aspects of 631 csv files, all stored in different folders. Each csv file is titled with a county code, ranging from 1003 to 55139. I only want rows with data (there should be 631) in my result table, but I continuously have 55139 rows - the highest code number I have. I tried to use indexing to find the specific codes, but my result table is still 55139 rows. Code is below.
dataset=xlsread('peaks_locs.xlsx','Sheet2','A1:A632');
whichBin = {2012:2013};
binType = 'annual';
binList = {2012:2013};
geoRegion = 'FIPS';
whichYears = [2012:2013];
whichDay = 'wkday';
%make sure this is the unique ID of the directory you want to use!
randStr = 'gbqo';
for geoCode=dataset(1):dataset(631)
csvData = ['tweetogramsMili/tweetograms_' binType '_' geoRegion '_2012_2013_' randStr '/' binType '/' whichDay '/' num2str(geoCode) '.csv'];
if ~exist(csvData,'file'),continue,end
tweetogramData = csvread(csvData);
tweetogramSmooth = smooth(tweetogramData);
[lunchpk, loc1] = max(tweetogramSmooth(44:60));
[dinnerpk, loc2] = max(tweetogramSmooth(68:92));
lunchloc = loc1 + 43;
dinnerloc = loc2 + 67;
outTable(geoCode,:) = table(geoCode, whichDay, lunchloc, lunchpk, dinnerloc, dinnerpk);
end
Essentially, how can I change my code so the "outTable" result gives me just a 631 row table, rather than one that is 55139 rows? All the rows that do not have data currently have a '0' in them.
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!