分配simulink/matlab时为什么要删除ans? [英] Why is one ans removed when assigning simulink/matlab?
本文介绍了分配simulink/matlab时为什么要删除ans?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么在分配y时将ans删除?我想返回两个描述.
Why is one ans removed when I assign y? I want to return the two descriptions.
x = rmi('get',gcs)
x =
2x1 struct array with fields:
doc
id
linked
description
keywords
reqsys
>> x.description
ans =
FirstReq
ans =
SecondRec
>> y = x.description
y =
FirstReq
>> y
y =
FirstReq
推荐答案
您可能需要使用{}
:
>> x.description
ans = FirstReq
ans = SecondRec
>> y = {x.description}
y =
{
[1,1] = FirstReq
[1,2] = SecondRec
}
然后您可以使用()
(输出将是一个单元格数组)或{}
(输出将是description
字段的数据类型)来索引到y
:
You can then index into y
using either ()
(output will be a cell array) or {}
(output will be whatever the data type of the description
field is):
>> y(1)
ans =
{
[1,1] = FirstReq
}
>> y{1}
ans = FirstReq
注意 :我使用的是Octave,而不是MATLAB,但仍应使用.
Note: I am using Octave, not MATLAB, but it should still apply.
这篇关于分配simulink/matlab时为什么要删除ans?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文