Obtain variable value indirectly in Matlab

1

I have the name of n variables stored in a struct "list", and I would like to show the value of the variables by means of the position of the struct, that is:

 var_1=3


 lista{1}='var_1'

so that by entering lista{1} you print 3 , and not the string 'var_1' .

    
asked by Julian 20.01.2017 в 01:18
source

1 answer

0

It could work if you just remove the single quotes, this will assign the value that the variable has and not a string.

var_1 = 3;
lista{1} = var_1
lista = 
     [3] . . .
      .
      .
      .
    
answered by 20.01.2017 в 04:46