Collecting and rearranging excel data

조회 수: 5 (최근 30일)
Mikkel Ibsen
Mikkel Ibsen 2020년 4월 16일
답변: darova 2020년 4월 18일
Hi
I have a bit of a nightmare of collecting and rearranging some excel data. The excel data is spread into different worksheets, but have the same numbers of coloums but not the same number of rows.
I need to identify a persons name, and pluck the row of data from each worksheet in the excel file, and combine them into a table arranged by the date, that I then can write into a new excel file.
My problem is that the names are not always to be found in the worksheet, because it shows if they were there or not.
The player names that needs to be made a excel data file for:
Spillere = ({'Mikkel Ibsen ';'Rasmus Skram ';'Jacob Bjarkam ';'Kristoffer Bendixen ';...
'Rune Ott ';'Søren Bjørn Nedergaard ';'Rasmus Hansen ';'Anders Thode ';'Malthe Lund Mortensen ';'Martin Winther Larsen ';'Kresten Mosbæk Gravesen ';...
'Tonny Jensen ';'Thomas Gøtke ';'Mikkel Skov Christensen ';'Magnus Leth Nielsen ';'Kasper Ørkild ';'Anders Fugmann ';'Andreas Laursen ';'Thomas Gaardsøe '});
Spillere = strtrim(Spillere);
If you need to remove Æ, Ø and Å which is danish Ive done it with this:
for h = 1:size(Spillere,1)
Spillere_2{h,1}= Spillere{h,1}(~isspace(Spillere{h,1}));
Spillere_2 = strrep(Spillere_2,'ø','oe');
Spillere_2 = strrep(Spillere_2,'Ø','oe');
Spillere_2 = strrep(Spillere_2,'æ','ae');
Spillere_2 = strrep(Spillere_2,'å','aa');
end
Spillere = strtrim(Spillere);
Hope someone can help me.
Best Regards Mikkel
  댓글 수: 1
Mikkel Ibsen
Mikkel Ibsen 2020년 4월 18일
Still no one that can show me how to do this? :(

댓글을 달려면 로그인하십시오.

답변 (1개)

darova
darova 2020년 4월 18일
Try this
clc,clear
A = []
[s1,info1] = xlsfinfo('Season 2017.xls');
for i = 1:numel(info1)
A1 = readtable('Season 2017.xls','sheet',i);
ix = ~cellfun(@isempty,table2array(A1(:,1)));
A = [A;A1(ix,1:26)];
end
B = sortrows(A);
Do you know why MATLAB imports this trash sometimes?

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by