开发者

How to save the use of a temporary variable in MATLAB [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

matlab array index without assigning to a local variable

Hi All,

I am having a very basic question in using matlab. I want to save the use of a in the following code when using matlab:

a=[1开发者_如何学运维,2,3]
a(2:3)

[1,2,3](2:3) is now allowed.

??? [1 2 3](2:3)

|

Error: Unbalanced or misused parentheses or brackets.

Is there any function to get the element of a vector besides the [] operator? The reason I ask this is that: sometimes when a function returns a vector and I want to get only the second element in the vector, I do not want to save the function return to a temporary variable before I get its second element. Is there any way?

Many thanks!


This might be of interest:

File Central - Direct Indexing of Function Calls

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜