How could I eliminate the meter names with an 'x' after them?
Posted
by
Rose Comete
on Stack Overflow
See other posts from Stack Overflow
or by Rose Comete
Published on 2012-06-26T08:50:08Z
Indexed on
2012/06/26
15:16 UTC
Read the original article
Hit count: 198
matlab
Hi I imported some Excel data into MatLab - it is a list of about 200 meter names with about 28 rows each, but the problem is that for each there is a duplicate for the other direction - with the same meter name with an 'x' after it.
Does anyone have any ideas as to how I can eliminate these ones with an 'x' after wards? Attached is the part of my code that imports the data, but unfortunately I have not got enough points on this site yet to be allowed to upload data/photos x
clear all
fid=fopen('sue1.csv'); % Open the file sue1.csv and read it all and put it into an array
data = textscan(fid,'%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s','Delimiter',',','CollectOutput',1);
fclose(fid)
j = 1; k = 1; % j - turbine number, k - date number
for i = 1:length(data{1,1}) % Run through all the data
if strcmp(data{1,1}(i),'') == 0
meterold{j}(k,:) = data{1,1}(i,:);
% if strcmp(data{1,1}(i),'MeterName') == 0
% nummeter{j}(k,:) = str2num(data{1,1}(i,3:end));
% end
k = k + 1;
else
% These commands are followed in the strings match (empty line)
k = 1; % Reset the day counter as we're back to the beginning
j = j + 1; % Add one to the meter counter as we're now looking at
% a new turbine
end
end
© Stack Overflow or respective owner