Assign multiple results to the same variable

조회 수: 8 (최근 30일)
Chesus
Chesus 2023년 8월 31일
답변: Chesus 2023년 8월 31일
I'm doing a code that uses while, and inside that while is a variable whose value gets changed every instance, I want to store all those values on a single variable to table it later, how can I do that?
  댓글 수: 3
Chesus
Chesus 2023년 8월 31일
Thanks a lot, I didnt understand it at first but it ended up helping me

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

채택된 답변

Chesus
Chesus 2023년 8월 31일

indexing the varoable is the solution

if true
  % code
k=0
while ... %the condition you decide
k=k+1 %by experience k must be >0, idk why
data(k)=...%you can change the word "data", after the equal must be the value you want to store, then you can call this values as the variable "data"
end
end

Answer originally posted by Mathieu NOE

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by