Load .slk file format (excel can open it, but can't import it to matlab)
22 views (last 30 days)
Show older comments
I am trying to import in matlab a file with extension '.slk'. Although in excel it is opened as a normal file, with info in differents cells, I cannot load it in Matlab as a cell structure, as a normal excel would. I have to process many of those files, that's why exporting as csv from excel is not doable...
The closest I have got is to use the function 'extractFileText'. Either with differents options for 'encoding' or without them, I can only get a string with the info like the code below. Before posting the code, I attach a picture of how the file looks in an excel-like software:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/773703/image.png)
It somehow includes the info I am trying to extract, but I don't know how to deal with a string of this kind, and I wonder whether there is a way of importing the data as a cell structure or variables for each colum...
Could anyone, please, help?
>> data = extractFileText(excelname)
data =
data =
"ID;PANYMAZE
P;PGeneral
P;FArial;M200
P;EArial;M0
B;X10;Y7
F;R1;M240
F;R2;M240
F;R3;M240
F;R4;M240
F;R5;M240
F;R6;M240
F;R7;M240
F;C1;SM1;FF0R
F;W1 1 5
F;C2;SM1;FF0R
F;W2 2 7
F;C3;P0;SM1;FG0L
F;W3 3 10
F;C4;P0;SM1;FG0L
F;W4 4 5
F;C5;P0;SM1;FG0L
F;W5 5 12
F;C6;SM1;FF0R
F;W6 6 6
F;C7;P0;SM1;FG0L
F;W7 7 18
F;C8;P0;SM1;FG0L
F;W8 8 14
F;C9;SM1;FF1R
F;W9 9 27
F;C10;SM1;FF1R
F;W10 10 24
F;X1;Y1;FG0L
C;X1;Y1;K"Test"
F;X2;Y1;FG0L
C;X2;Y1;K"Animal"
F;X3;Y1;FG0L
C;X3;Y1;K"Treatment"
F;X4;Y1;FG0L
C;X4;Y1;K"Code"
F;X5;Y1;FG0L
C;X5;Y1;K"Stage"
F;X6;Y1;FG0L
C;X6;Y1;K"Trial"
F;X7;Y1;FG0L
C;X7;Y1;K"Segment_of_test"
F;X8;Y1;FG0L
C;X8;Y1;K"Apparatus"
F;X9;Y1;FG0L
C;X9;Y1;K"Zona_de_no_refuerzo_._time"
F;X10;Y1;FG0L
C;X10;Y1;K"Zona_de_refuerzo_._time"
C;X1;Y2;K1
C;X2;Y2;K1
C;X3;Y2;K""
C;X4;Y2;K""
C;X5;Y2;K"First stage"
C;X6;Y2;K1
C;X7;Y2;K"0 - 300 secs."
C;X8;Y2;K"New apparatus"
C;X9;Y2;K279.4
C;X10;Y2;K20.6
C;X1;Y3;K1
C;X2;Y3;K1
C;X3;Y3;K""
C;X4;Y3;K""
C;X5;Y3;K"First stage"
C;X6;Y3;K1
C;X7;Y3;K"300 - 600 secs."
C;X8;Y3;K"New apparatus"
C;X9;Y3;K294.2
C;X10;Y3;K5.8
C;X1;Y4;K1
C;X2;Y4;K1
C;X3;Y4;K""
C;X4;Y4;K""
C;X5;Y4;K"First stage"
C;X6;Y4;K1
C;X7;Y4;K"600 - 900 secs."
C;X8;Y4;K"New apparatus"
C;X9;Y4;K300.0
C;X10;Y4;K0.0
C;X1;Y5;K1
C;X2;Y5;K1
C;X3;Y5;K""
C;X4;Y5;K""
C;X5;Y5;K"First stage"
C;X6;Y5;K1
C;X7;Y5;K"900 - 1200 secs."
C;X8;Y5;K"New apparatus"
C;X9;Y5;K293.0
C;X10;Y5;K7.0
C;X1;Y6;K1
C;X2;Y6;K1
C;X3;Y6;K""
C;X4;Y6;K""
C;X5;Y6;K"First stage"
C;X6;Y6;K1
C;X7;Y6;K"1200 - 1500 secs."
C;X8;Y6;K"New apparatus"
C;X9;Y6;K300.0
C;X10;Y6;K0.0
C;X1;Y7;K1
C;X2;Y7;K1
C;X3;Y7;K""
C;X4;Y7;K""
C;X5;Y7;K"First stage"
C;X6;Y7;K1
C;X7;Y7;K"1500 - 1800 secs."
C;X8;Y7;K"New apparatus"
C;X9;Y7;K300.0
C;X10;Y7;K0.0
E
"
0 Comments
Answers (1)
millercommamatt
on 22 Oct 2021
data = readtable('your_spreadsheet.slk','FileType','spreadsheet');
0 Comments
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!