嗨,我将 Excel 数据导入 MATLAB,它是一个包含大约 200 个仪表名称的列表,每个名称大约有 28 行。
问题在于,对于每个方向,另一个方向都有一个重复项,其仪表名称相同,'x'
后面有一个。
有谁知道我'x'
以后如何消除这些?
以下是我导入数据的代码部分:全部清除
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