From: simone on
Hi Everybody,
I am new in MatLab and I have already checked previous posts without success.
Here is my question:
I have two column vectors, one with string values, which are even the names of the parameters of a function I have to use later, the other one with integer values, which are the values of the parameters.
I read this values from a file.txt.
Is there any chance to assign integer values to the string one?.

this is the code:
[param, val]=textread('prova.txt', '%8s %5d');
>> param
param =
'Termico'
'eneIncid'
'marco'
'luigi'
'vdkf'
>> val
val =
0
100
984
325
234

Thank you
From: Oleg Komarov on
"simone "
> Hi Everybody,
> I am new in MatLab and I have already checked previous posts without success.
> Here is my question:
> I have two column vectors, one with string values, which are even the names of the parameters of a function I have to use later, the other one with integer values, which are the values of the parameters.
> I read this values from a file.txt.
> Is there any chance to assign integer values to the string one?.
>
> this is the code:
> [param, val]=textread('prova.txt', '%8s %5d');
> >> param
> param =
> 'Termico'
> 'eneIncid'
> 'marco'
> 'luigi'
> 'vdkf'
> >> val
> val =
> 0
> 100
> 984
> 325
> 234
>
> Thank you

Old debated issue if you're trying to do:
Termico = 0;
in order to create as many variables in the ws as the number of rows in param.

Everybody will suggest to use structure with dynamic fields like this:
Dati.(param{ii}) = val(ii);

To do it in one shot:
Dati = cell2struct(num2cell(val), param);

Oterways eval('fliplr(''.BALTAM fo edis krad eht rof oG'')')

Oleg