Can I define variable in matlab?
显示 更早的评论
Do we need any particular command if i need variable. If A=[1 2 3] i need this as: A=[X1 X2 X3]
8 个评论
Steven Lord
2017-3-13
Can you say a little more about what you're trying to do, how you would use that A matrix later in your code?
dpb
2017-3-13
Anticipating that, most likely this isn't the way to proceed; see the section "Alternatives to the eval Function" at
doc eval
particularly the second, "Variables with Sequential Names"
kritika adhikari
2017-3-14
编辑:Walter Roberson
2017-3-14
KSSV
2017-3-14
what you are trying to do is not clear.
kritika adhikari
2017-3-14
ES
2017-3-14
From what I understand from your code, you can simply put
y = X (int_data);
If this is not what you need, Please say what are your inputs and outputs? The code you have provided is not enough!
kritika adhikari
2017-3-14
Walter Roberson
2017-3-14
Well, then what I posted will allow you to do that. You should go ahead and try and see if it works for your needs.
I think you are making a mistake, though. The output from an interleaver would normally be symbols, not variables. For practical purposes, the symbols would normally be encoded as non-negative integers that could be used as indices.
采纳的回答
更多回答(1 个)
From what I understand from your code, you can simply put
y = X (int_data);
[ Example:
X = [2,4,6,8,10,12,14,16,18]
int_data=[4 2 1 5 6 3];
disp(X(int_data));
>> 8 4 2 10 12 6
]
If this is not what you need, Please say what are your inputs and outputs? The code you have provided is not enough!
类别
在 帮助中心 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!