How to for loop through variables with two columns
이전 댓글 표시
Hey, New to matlab and struggling with looping through variables. I have four variables that consist of the M and C values for calibration equations (y=mx+c) on four sperate days the variables are in this form:
C_CalEquation =
491.8587 -200.3298
352.5991 -114.2691
493.8250 -207.9643
652.4300 -294.4432
632.3712 -287.7151
407.7223 -152.0045
D_CalEquation =
490.4674 -199.8723
352.2292 -114.3976
492.5757 -207.6984
653.8977 -295.1794
632.3712 -287.7151
407.7223 -152.0045
Where column 1 is m and 2 is c
i'm trying to loop through these four variables to convert voltage into mm using these equations. I'm trying to use this code:
for r=(A_CalEquation B_CalEquation C_CalEquation D_CalEquation)
P1mm=(Probe1.*r(1,1))+r(1,2)
P2mm=(Probe2.*r(2,1))+r(2,2)
P3mm=(Probe3.*r(3,1))+r(3,2)
P4mm=(Probe4.*r(4,1))+r(4,2)
P5mm=(Probe5.*r(5,1))+r(5,2)
P6mm=(Probe6.*r(6,1))+r(6,2)
however the r=(A_CalEquation B_CalEquation C_CalEquation D_CalEquation) only returns the variables as a single column
r =
495.8334
354.1180
494.9175
653.8977
642.7533
406.8550
how do i make the for loop recognise the variables as two columns and not just a single one??
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!