How to automatically pull values from matrix and set as variables

조회 수: 8 (최근 30일)
Garrett
Garrett 2017년 8월 2일
편집: Stephen23 2019년 6월 19일
I have a matrix ex.
A=[11,7,3;9,13,5],
and I want to have a series of variables where
c1=1
c2=7
c3=3
c4=9
c5=13
c6=5.
How can I do an operation like this for any size matrix and note it is important that they are numbered in a certain direction. This is so in a later operation I can input c5 in an equation and it be the value located in A(2,2).
  댓글 수: 5
Garrett
Garrett 2017년 8월 2일
I am sorry but I do not know who to do that. That sounds right but I have no idea where to start that
Garrett
Garrett 2017년 8월 2일
Never mind, I got it working

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

채택된 답변

Akhilesh Thakur
Akhilesh Thakur 2017년 8월 2일
https://stackoverflow.com/questions/14360501/extract-parts-of-a-big-matrix-and-allocate-them-in-new-variables-with-loop-funct
I guess this is what you are looking for Hope this helps.
  댓글 수: 4
Akhilesh Thakur
Akhilesh Thakur 2017년 8월 3일
I guess still eval is used everywhere. Thanks for your comments on eval

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

추가 답변 (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