Strange eval behaviour with cells
1 view (last 30 days)
Show older comments
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.
0 Comments
Answers (0)
See Also
Categories
Find more on Programming Utilities in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!