From: Erik-Jan Boonen on
Hello,

I am trying to produce a table in Excel and import it into matlab. Now I have the following problem. I want to use another table name in the excel table, but this is imported as a cell named textdata, but I just want a table as double eg.:

Ship_prop = [Laden Laden Laden]

and Laden = [1, 2, 3, 4, 5, 6 , 7, ...];

I have a multiple lookup table's in sumulink with the link: Ship_prop(:,1), etc.

How can I manage this? The idea is that I just have to change one variable (Laden to eg. Ballast) and all the belonging variables change. I use excel, because it works much easier and I can easily adjust the table. Importing from excel with numbers is not a problem.

Gr. Erik-Jan

Now I get:

data (as double)=

1.0e+005 *

0 0.2160 0.2180 0.8480 0.8500 1.3014
0.0001 0.0001 0.0001 0.0001 0.0001 0.0001
0.0002 0.0002 0.0002 0.0002 0.0004 0.0004
2.9900 2.9900 2.9900 2.9900 2.9900 2.9900
0 0 0 0 0 0

and

textdata (as cell)=

'Rotterdam - Olso' '' '' '' '' '' ''
'T_operation' '' '' '' '' '' ''
'SLC' '' '' '' '' '' ''
'Head_angle' '' '' '' '' '' ''
'P_aux_elec' '' '' '' '' '' ''
'P_BT' '' '' '' '' '' ''
'Ship_prop' 'Laden' 'Laden' 'Laden' 'Laden' 'Laden' 'Laden'

But I want as double:

0 21600 21800 84800 85000 130144
11,67 11,67 11,67 11,67 11,67 11,67
16,25 16,25 24,62 24,62 38,11 38,11
2,99E+05 2,99E+05 2,99E+05 2,99E+05 2,99E+05 2,99E+05
0 0 0 0 0 0
Laden Laden Laden Laden Laden Laden
From: Erik-Jan Boonen on
I solved the problem with the eval() function!

This function runs a string as a double. By putting this in a for statement the matrix can be build.

for i=2:length(Input_voyage.textdata.Sheet1)
Ship_prop{i-1} = eval(Input_voyage.textdata.Sheet1{7,i});
end
Ship_prop = cell2mat(Ship_prop);

Gr. Erik-Jan