필터 지우기
필터 지우기

How to only display the rows with data in the result table

조회 수: 1 (최근 30일)
Mili Shah
Mili Shah 2018년 7월 20일
I have code to calculate specific aspects of some data. The results, by county, are stored in a table, based on each county's identification code. I have county numbers that go up to 55139, but I only want my result table to display the rows that have data - right now all the blank county codes have zeros. How can I do this?
for geoCode=1003:55139
whichBin = {2012:2013};
binType = 'annual';
binList = {2012:2013};
geoRegion = 'FIPS';
whichYears = [2012:2013];
whichDay = 'MTWThFSatSun';
%make sure this is the unique ID of the directory you want to use!
randStr = 'ckvc';
csvData = ['tweetograms/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
My result table has a row for each number 1-55139, but I only have about 631 county codes total. How can I eliminate the rows that don't have any data from my table so it is compact?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by