안녕하세요. Excel 데이터를 MATLAB으로 가져 왔습니다. 각 행의 이름은 약 200 미터이며 약 28 행입니다.
문제는 각 방향에 대해 다른 방향에 대해 동일한 미터 이름과 'x'
과 중복되는 것이 있다는 것입니다.이름 뒤에 '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
질문이 데이터 (또는 적어도 샘플)없이 혼란 스럽습니다. 내가 말할 수있는 것은 CSV 형식을 읽고 있다면'csvread'를 사용하지 않는 이유는 무엇입니까? –
코드 스 니펫의 형식을 올바르게 지정하면 Google에서 쉽게 이해할 수 있습니다. –