Strange eval behaviour with cells
11 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!