필터 지우기
필터 지우기

Print matrices whose name is based on loop values

조회 수: 1 (최근 30일)
Paras Choudhary
Paras Choudhary 2022년 7월 21일
답변: Steven Lord 2022년 7월 21일
for i = 1:3
eval(['k' num2str(i) '=i']);
end
%% Doubt - How to print k1, k2, k3 based on iteration no. ???

채택된 답변

Steven Lord
Steven Lord 2022년 7월 21일
Can you dynamically create variables with numbered names like k1, k2, k3, etc.? Yes.
Should you do this? The general consensus is no. That Answers post explains why this is generally discouraged and offers several alternative approaches.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by