Multiply two cells of an table.

조회 수: 3 (최근 30일)
Mapete
Mapete 2022년 5월 21일
편집: Mapete 2022년 6월 7일
Never mind.

채택된 답변

Voss
Voss 2022년 5월 21일
EM_Volllastkurve = table([0;100;200;300],[550;550;550;550],'VariableNames',{'Drehzahl' 'Drehmoment'})
EM_Volllastkurve = 4×2 table
Drehzahl Drehmoment ________ __________ 0 550 100 550 200 550 300 550
To multiply (row 1, column 1) by (row 1, column 2):
EM_Volllastkurve{1,1}*EM_Volllastkurve{1,2}
ans = 0
% or
EM_Volllastkurve{1,'Drehzahl'}*EM_Volllastkurve{1,'Drehmoment'}
ans = 0
to do the same for all rows of the table:
EM_Volllastkurve{:,1}.*EM_Volllastkurve{:,2}
ans = 4×1
0 55000 110000 165000
% or
EM_Volllastkurve{:,'Drehzahl'}.*EM_Volllastkurve{:,'Drehmoment'}
ans = 4×1
0 55000 110000 165000
  댓글 수: 4
Mapete
Mapete 2022년 5월 21일
At last i would like to save the calculations for every row, and plot them in a diagram.
Voss
Voss 2022년 5월 21일
Well, they are saved in the EM_Volllastkurve table already, and here's a plot of Leistung vs Drehzahl:
EM_Volllastkurve = table((0:100:1100).',550*ones(12,1),'VariableNames',{'Drehzahl' 'Drehmoment'});
EM_Volllastkurve.Leistung = EM_Volllastkurve.Drehmoment.*EM_Volllastkurve.Drehzahl*2*3141/60000;
plot(EM_Volllastkurve.Drehzahl,EM_Volllastkurve.Leistung)
xlabel('Drehzahl')
ylabel('Leistung')

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!