How can I put a set of data into a vector ?

조회 수: 6 (최근 30일)
wantinga
wantinga 2023년 3월 9일
댓글: wantinga 2023년 3월 10일
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
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.
wantinga
wantinga 2023년 3월 10일
Ok! Thanks for your answer! I will change the way to name the data.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by