Strange eval behaviour with cells

11 visualizaciones (últimos 30 días)
GerdaHotlich
GerdaHotlich el 17 de Abr. de 2014
Editada: GerdaHotlich el 17 de Abr. de 2014
Hi there!
When trying to pass cell values to varargout, I noticed a strange behaviour of the eval function:
A = {1,2,3};
B1 = { A{1:3} }
B2 = { eval( 'A{1:3}' ) }
returns:
B1 =
[1] [2] [3]
B2 =
[1]
However,
eval( 'A{1:3}' )
returns
ans =
1
ans =
2
ans =
3
So I ask myself, where do the remaining cells get lost? In contrast,
A{1:3}
eval( 'A{1:3}' )
[B2, B3, B4] = A{1:3}
[B2, B3, B4] = eval( 'A{1:3}' )
generate equal outputs respectively.

Respuestas (0)

Categorías

Más información sobre Variables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by