How do I "navigate" in textscann function

1 visualizzazione (ultimi 30 giorni)
Isa Duran
Isa Duran il 27 Giu 2014
Commentato: Isa Duran il 27 Giu 2014
Hi guys ! I have a excel file where a want to read different numbers and store them into a matrix. My issue is I don't know how to navigate with use of textscan.
My Excel file:
Torm Lilly Phily - Gothenborg
INITIAL DATA
Loading condition Design
Displacement 57282.00 t
Ae/A0 0.58
Blades 4.00
Propeller diameter 8.05 m
WEST EAST DIRECTION
Speed [Knob] 5.00 7.50 10.00 12.50 15.00 17.50
Max. Power [kW] 2186.00 4097.00 7779.00 13981.00 25105.00 56147.00
Max. RPM 52.00 64.00 80.00 97.00 117.00 151.00
Mean Power[kW] 1117.70 2196.30 4065.20 7806.50 14093.00 25644.00
Mean RPM 41.00 52.00 63.00 79.00 96.00 116.00
Mean standard deviation RPM 4.35 3.80 3.11 3.83 4.24 5.29
Mean standard deviation Power 324.00 470.04 669.72 1011.20 1595.90 4310.60
My code is:
fid = fopen('Torm_Philly_Gothenburg.xlsx');
C = textscan(fid, '%f %f',1)
C{:}
fclose(fid);
If I want to import lets say all the Max.Power row, how do I tell in "C = textscan(fid, '%f %f',1)" Which row and collum it should read from ?
Hope you understand my issue!
Thanks!

Risposta accettata

Cedric
Cedric il 27 Giu 2014
Modificato: Cedric il 27 Giu 2014
You need to use XLSREAD instead of FOPEN/TEXTSCAN, because the content of XLSX files is not text. Look at the doc of XLSREAD
>> doc xlsread
and you'll see that you can specify the name of the worksheet and the range.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by