matlab - 如何在 Maltab 中更改变量的名称(添加索引)?
问题描述
我有以下脚本:
a=[1,2,3]
for i=1:length(a)
e=0;
e1=0;
e2=0;
.....
end
在脚本中,主循环(第一个)是 for i=1:length(a)
. e
, e1
,e2
应该为每个重写为a(i)
:
% I count the error
a=1: e=0;
e1=0;
e2=0;
a=2: e=0;
e1=0;
e2=0;
a=3: e=0;
e1=0;
e2=0;
根据我的第一个脚本,Matlab为每个e
, e1
,e2 , but I need
e ,
e1重写。,e2
a(i)
问题:是否可以更改每个变量的名称a(i)
?
% to change like this?
a=1: e_a_1=0;
e1_a_1=0;
e2_a_1=0;
a=2: e_a_2=0;
e1_a_2=0;
e2_a_2=0;
a=3: e_a_2=0;
e1_a_2=0;
e2_a_2=0;
解决方案
推荐阅读
- javascript - 如何过滤列表视图中的内部子元素以及使用 Jquery 将字母滚动条添加到移动应用程序中的列表视图的任何简单方法
- angular - 如何使用 angular2 将可迭代 id 存储在 div 标签内的#refernce 变量中?
- c# - Entity Framework 6.2.0 不生成某些类(数据库优先)
- php - 如何访问数组中的值或数组中的数组
- database - 使用没有 ACE.OLEDB 提供程序的数据库
- react-native - 运行 detox/wix 测试用例 android.util.AndroidException: INSTRUMENTATION_FAILED:
- android - 必须在 Android Studio 中实现 OnFragmentInteractionListener 错误
- c# - C# WPF Treeview ItemContainerStyle 使 mouseclick 事件发送者丢失 TreeviewItem 引用
- c - 比较 C 中的哈希值
- php - codeigniter中的登录错误消息验证