How to assign multiple variables to an array
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi Sir, i want to assign variables automatically to the valaues in an array how shall i do it?
TN=4;
PT=17*1000;
del=0.6;
%No=174;
No=0.01;
d= 8304.215;
sigma=2.7;
g=rand(1,TN);
PRn=((del*PT*g)./(1-d^sigma)*No);
Pt=num2cell(PRn);
[N1 N2 N3 N4]=deal(Pt{:})
in this code i am manually assigning the names to the array PRn
답변 (1개)
KSSV
2019년 2월 26일
What is the necessity to assign? YOu can access them by PRn(1), PRn(2)..etc..It is a bad idea to do so.
댓글 수: 2
KSSV
2019년 2월 26일
i just want to save them in different variables automatically, this is not at all necessary.....
By doing this how can i use it in further calculations call them by PRn(1), PRn(2)..etc
참고 항목
카테고리
Help Center 및 File Exchange에서 Function Creation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!