How to define variable (for later use) that contains another defined variables
조회 수: 14 (최근 30일)
이전 댓글 표시
Simple question
I.e I have variable N=Np/Ns. I;ve defined values for Np and Ns (which I may want to change later) but for my latter euqations I want to put simply only N, insteed of typing Np/Ns. How to define N in that way when I pun N in some equation it will pass Np/Ns.
I've tried simply N = 'Np/Ns' , but when I checked it by typing F = N + 1, insteed of simply calculate F = Np/Ns + 1, the output is strange 8 element matix.
댓글 수: 1
Stephen23
2022년 5월 19일
"the output is strange 8 element matix"
Not very strange: you created a character vector and then added one to every character code:
1+'Np/Ns'
If you want to perform numeric/symbolic operations, character vectors are unlikely to be the solution.
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numeric Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!