Info
此问题已关闭。 请重新打开它进行编辑或回答。
i need some help
1 次查看(过去 30 天)
显示 更早的评论
i want to assign variable depend on anothor variable
3 个评论
John D'Errico
2020-2-17
Learn to use MATLAB as a vector and array language. After all, that is how it is designed to be used.
回答(1 个)
Bob Thompson
2020-2-17
编辑:Bob Thompson
2020-2-17
If I'm understanding what you're trying to do, you're only missing parentheses.
>> n = 10;
>> p(10) = 2;
>> p(n)
p(n) =
2
You can also assign values in a similar manner.
>> n = 10;
>> p(n) = 2;
>> p(10)
p(10) =
2
2 个评论
Bob Thompson
2020-2-18
Yes, because the value inside the parentheses is referencing a position within an array. You cannot call a 0 placement, because a 0 position doesn't make sense.
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!