How can I put a set of data into a vector ?
2 次查看(过去 30 天)
显示 更早的评论
For a1,a2,...,a100, I want to set a = [a1 a2 ... a100]. Is there a better way?Thanks very much for your answers!
5 个评论
Stephen23
2023-3-9
编辑:Stephen23
2023-3-9
"How can I use the loop to calculate outputden_sym1-sym8?"
The name MATLAB comes from "MATrix LABoratory", so you should use some kind of matrix/array and indexing, e.g.:
N = 100:
C = cell(1,N);
for k = 1:N
V = ... whatever output or data you want to store
C{k} = V; % basic indexing
end
See also:
Do NOT number variable names like you show in your question, unless you really want to force yourself into writing slow, complex, inefficient code to process your data.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!