Calculate output row by row (Data Grid)

8 Ansichten (letzte 30 Tage)
Shahid Said
Shahid Said am 29 Apr. 2021
Kommentiert: Shahid Said am 30 Apr. 2021
Hello,
I would like to calculate all the row value based on formula and get the output row by row which at new column.because I need to use more than 10 formula by refer to the my which generated by combination as below.
I change from meshgrid to ngrid as below and I can get result as expected 400k rows.
because meshgrid cannot support more than 3 variable.
[a,b,c,d,e]=ndgrid(1:20,1:20,1:10,1:10,1:10);
data=[a(:),b(:),c(:),d(:),e(:)];
Car={'C1', 24 , 8.86 , 9.37 , 38.65 , 31.61 , 280 , 25 , -0.0033 , -0.004 , 0.058 , 45 , 0.97;...
'C2', 24 , 8.68 , 9.37 , 38.6 , 32.4 , 280 , 25 , -0.0034 , -0.004 , 0.057 , 46.5 , 0.98;...
more data
Lamp= {'Lamp1', 24 , 200;...
'Lamp', 24 , 200;...
more data
Seat={'1',147 , 32 , 145;...
'S2', 138 , 120 , 140;...
more data
and 2 more variable
ExpandData=[Car(data(:,1),:), Lamp(data(:,2),:), Seat(data(:,3),:), Bumper(data(:,4),:), Spoiler(data(:,4),:)]
Example :
Speed = C1 Column no 2 row 1 .* L1 Column 2 row 1 .* Seat Column1 row 1
anybody can help me?

Antworten (1)

KSSV
KSSV am 29 Apr. 2021
Read about table.
  1 Kommentar
Shahid Said
Shahid Said am 30 Apr. 2021
clc
clear
%Create Combination
[a,b,c,d,e]=ndgrid(1:2,1:2,1:2,1:2,1:2);
data=[a(:),b(:),c(:),d(:),e(:)];
PV={'PV1',1,2,3,4,5;...
'PV2',1,2,3,4,5};
Batt={'B1',1,2,3,4,5;...
'B2',1,2,3,4,5};
MPPT={'MPPT1',1,2,3,4,5;...
'MPPT2',1,2,3,4,5};
Inverter={'Inv1',1,2,3,4,5;...
'Inv2',1,2,3,4,5};
DieselGenerator={'DG1',1,2,3,4,5;...
'DG2',1,2,3,4,5};
ExpandData1=[PV(data(:,1),:), Batt(data(:,2),:), MPPT(data(:,3),:), Inverter(data(:,4),:), DieselGenerator(data(:,5),:)]
table = ExpandData1(:,3);
table2 = ExpandData1(:,4);
output = ExpandData1(:,3)* ExpandData1(:,4)
error at last line...

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by