Strange eval behaviour with cells

11 ビュー (過去 30 日間)
GerdaHotlich
GerdaHotlich 2014 年 4 月 17 日
編集済み: GerdaHotlich 2014 年 4 月 17 日
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 件)

カテゴリ

Help Center および File ExchangeVariables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by