How can write and store my data in function file to excel file ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi , i have function contain on data as below ( different columns) , how can store each column( inside data function ) to excel file ? or save them into individual matrix?
for example :
A= avg_delay ;
B= throughput ;
...
on [max_pir, max_throughput, min_delay] = routingfullyadaptiveselthermaltopology3x3x3Route4()
data = [
% pir avg_delay throughput max_delay total_energy cores_energy routers_energy avg_power avg_cores_power avg_routers_power power_per_router static_per_router dynamic_per_router rpackets rflits
0.001 25.6335 0.0049682 192 0.000728556 0.000118972 0.000609584 7.28556e-08 1.18972e-08 6.09584e-08 2.25772e-09 1.589e-09 6.6872e-10 221 1328
0.011 25.9113 0.00552189 476 0.000792492 0.000119341 0.000673151 7.92492e-08 1.19341e-08 6.73151e-08 2.49315e-09 1.58903e-09 9.04119e-10 251 1476
0.021 24.9548 0.00396932 129 0.000730386 0.000118895 0.00061149 7.30386e-08 1.18895e-08 6.1149e-08 2.26478e-09 1.58899e-09 6.75785e-10 178 1061
0.031 28.9934 0.00347175 115 0.00073316 0.000118856 0.000614303 7.3316e-08 1.18856e-08 6.14303e-08 2.2752e-09 1.589e-09 6.86203e-10 158 928
0.041 27.7404 0.00253691 83 0.000730482 0.000118544 0.000611938 7.30482e-08 1.18544e-08 6.11938e-08 2.26644e-09 1.589e-09 6.77435e-10 108 653
0.051 29.0826 0.00255518 106 0.000733119 0.000118572 0.000614547 7.33119e-08 1.18572e-08 6.14547e-08 2.2761e-09 1.589e-09 6.87107e-10 116 683
0.061 31.6022 0.00213992 134 0.000765916 0.000118518 0.000647398 7.65916e-08 1.18518e-08 6.47398e-08 2.39777e-09 1.58902e-09 8.08751e-10 103 572
0.071 23.2826 0.00130832 89 0.000762364 0.000118063 0.000644302 7.62364e-08 1.18063e-08 6.44302e-08 2.3863e-09 1.58902e-09 7.97283e-10 51 272
0.081 29.807 0.00166667 127 0.000758546 0.000118257 0.000640289 7.58546e-08 1.18257e-08 6.40289e-08 2.37144e-09 1.58901e-09 7.82427e-10 66 363
0.091 32.2459 0.00162782 95 0.000756582 0.000118342 0.00063824 7.56582e-08 1.18342e-08 6.3824e-08 2.36385e-09 1.58901e-09 7.74841e-10 75 419
0.101 37.8125 0.00135101 110 0.000730201 0.00011841 0.00061179 7.30201e-08 1.1841e-08 6.1179e-08 2.26589e-09 1.589e-09 6.76887e-10 62 321
0.111 32.7727 0.000976431 104 0.000748178 0.000118043 0.000630135 7.48178e-08 1.18043e-08 6.30135e-08 2.33383e-09 1.58901e-09 7.44825e-10 31 174
0.121 41.8 0.00101928 94 0.000809844 0.000117999 0.000691844 8.09844e-08 1.17999e-08 6.91844e-08 2.56239e-09 1.58902e-09 9.73364e-10 21 111
0.131 41.2273 0.00139657 103 0.000731131 0.000118433 0.000612698 7.31131e-08 1.18433e-08 6.12698e-08 2.26925e-09 1.58901e-09 6.80245e-10 55 318
0.141 50.7692 0.000846931 108 0.000793249 0.000118082 0.000675168 7.93249e-08 1.18082e-08 6.75168e-08 2.50062e-09 1.58903e-09 9.11592e-10 21 109
0.151 46.0303 0.00120707 115 0.000763975 0.000118328 0.000645646 7.63975e-08 1.18328e-08 6.45646e-08 2.39128e-09 1.589e-09 8.0228e-10 43 239
0.161 62.5714 0.00105402 150 0.000757508 0.000118293 0.000639215 7.57508e-08 1.18293e-08 6.39215e-08 2.36746e-09 1.58902e-09 7.78448e-10 45 240
0.171 52.1818 0.000631313 82 0.000730147 0.000117878 0.000612269 7.30147e-08 1.17878e-08 6.12269e-08 2.26766e-09 1.589e-09 6.7866e-10 14 75
0.181 60 0.00047619 95 0.000767215 0.000117782 0.000649432 7.67215e-08 1.17782e-08 6.49432e-08 2.4053e-09 1.58902e-09 8.16287e-10 8 33
0.191 73.8421 0.000814394 139 0.00080778 0.000118052 0.000689729 8.0778e-08 1.18052e-08 6.89729e-08 2.55455e-09 1.58903e-09 9.65524e-10 27 129
0.201 62.5 0.000767677 95 0.000762804 0.000118017 0.000644787 7.62804e-08 1.18017e-08 6.44787e-08 2.3881e-09 1.58902e-09 7.9908e-10 8 38
0.211 69 0.000828283 90 0.000756177 0.000117816 0.000638361 7.56177e-08 1.17816e-08 6.38361e-08 2.3643e-09 1.58901e-09 7.75291e-10 9 41
0.221 67.5 0.000565657 114 0.000730236 0.000117939 0.000612297 7.30236e-08 1.17939e-08 6.12297e-08 2.26777e-09 1.589e-09 6.78767e-10 5 28
0.231 59.5 0.000555556 97 0.00073664 0.000117998 0.000618642 7.3664e-08 1.17998e-08 6.18642e-08 2.29127e-09 1.58901e-09 7.02258e-10 9 44
0.241 83.9474 0.000865801 140 0.000729821 0.000117985 0.000611837 7.29821e-08 1.17985e-08 6.11837e-08 2.26606e-09 1.589e-09 6.77059e-10 23 120
0.251 80.1154 0.000939394 109 0.000725549 0.000118231 0.000607318 7.25549e-08 1.18231e-08 6.07318e-08 2.24933e-09 1.589e-09 6.60325e-10 37 186
0.261 65 0.000633609 93 0.000787905 0.000118017 0.000669888 7.87905e-08 1.18017e-08 6.69888e-08 2.48107e-09 1.58903e-09 8.92038e-10 13 69
0.271 83.2308 0.00079798 122 0.000729951 0.000118065 0.000611886 7.29951e-08 1.18065e-08 6.11886e-08 2.26624e-09 1.589e-09 6.77244e-10 16 79
0.281 77.5 0.000871212 117 0.00073354 0.000118018 0.000615522 7.3354e-08 1.18018e-08 6.15522e-08 2.27971e-09 1.589e-09 6.90707e-10 14 69
0.291 72.9286 0.000761461 112 0.000736384 0.000118164 0.00061822 7.36384e-08 1.18164e-08 6.1822e-08 2.2897e-09 1.58901e-09 7.00692e-10 21 98
0.301 64.3333 0.000636364 88 0.000728682 0.000117963 0.000610719 7.28682e-08 1.17963e-08 6.10719e-08 2.26192e-09 1.589e-09 6.72922e-10 12 63
0.311 81.125 0.000846931 118 0.00073114 0.000118133 0.000613008 7.3114e-08 1.18133e-08 6.13008e-08 2.2704e-09 1.589e-09 6.81401e-10 22 109
0.321 91.75 0.000894661 115 0.000729737 0.000117962 0.000611776 7.29737e-08 1.17962e-08 6.11776e-08 2.26584e-09 1.589e-09 6.76841e-10 11 62
0.331 82.8 0.000636364 96 0.000734294 0.000117823 0.000616472 7.34294e-08 1.17823e-08 6.16472e-08 2.28323e-09 1.589e-09 6.94225e-10 13 63
0.341 76.3333 0.000631313 95 0.000728938 0.000118118 0.00061082 7.28938e-08 1.18118e-08 6.1082e-08 2.2623e-09 1.589e-09 6.73294e-10 12 50
0.351 97.2857 0.000769231 127 0.000731767 0.000117921 0.000613845 7.31767e-08 1.17921e-08 6.13845e-08 2.2735e-09 1.589e-09 6.84499e-10 18 99
0.361 86.8 0.000656566 100 0.00073546 0.00011787 0.00061759 7.3546e-08 1.1787e-08 6.1759e-08 2.28737e-09 1.58901e-09 6.98361e-10 8 39
0.371 91.4 0.000656566 96 0.000725904 0.000117865 0.000608039 7.25904e-08 1.17865e-08 6.08039e-08 2.252e-09 1.589e-09 6.62992e-10 10 52
0.381 85.5 0.000525253 102 0.000759293 0.000117855 0.000641438 7.59293e-08 1.17855e-08 6.41438e-08 2.37569e-09 1.58902e-09 7.8668e-10 5 26
0.391 95.2632 0.00118916 146 0.000783203 0.000118355 0.000664848 7.83203e-08 1.18355e-08 6.64848e-08 2.4624e-09 1.58901e-09 8.73394e-10 49 259
0.401 89.4286 0.000628507 101 0.000761524 0.000117838 0.000643687 7.61524e-08 1.17838e-08 6.43687e-08 2.38402e-09 1.58902e-09 7.95005e-10 10 56
0.411 64.5 0.000707071 70 0.00076015 0.000117694 0.000642456 7.6015e-08 1.17694e-08 6.42456e-08 2.37947e-09 1.58901e-09 7.90455e-10 2 14
0.421 100.647 0.000750361 139 0.000730178 0.000117888 0.00061229 7.30178e-08 1.17888e-08 6.1229e-08 2.26774e-09 1.589e-09 6.78741e-10 19 104
0.431 94.3333 0.000545455 100 0.000730798 0.000117935 0.000612863 7.30798e-08 1.17935e-08 6.12863e-08 2.26986e-09 1.58901e-09 6.80849e-10 5 27
0.441 80.4286 0.000568182 88 0.000730796 0.000118002 0.000612794 7.30796e-08 1.18002e-08 6.12794e-08 2.26961e-09 1.58901e-09 6.80599e-10 8 45
0.451 94.2667 0.000801347 114 0.000758086 0.000117983 0.000640102 7.58086e-08 1.17983e-08 6.40102e-08 2.37075e-09 1.58902e-09 7.81727e-10 26 119
0.461 83.5 0.00046176 107 0.000769577 0.000117946 0.000651631 7.69577e-08 1.17946e-08 6.51631e-08 2.41345e-09 1.58901e-09 8.24435e-10 9 32
0.471 98.3871 0.00126263 131 0.000758338 0.000118187 0.000640152 7.58338e-08 1.18187e-08 6.40152e-08 2.37093e-09 1.58901e-09 7.81925e-10 33 200
0.481 90.6667 0.000707071 115 0.000731416 0.000118026 0.00061339 7.31416e-08 1.18026e-08 6.1339e-08 2.27181e-09 1.58901e-09 6.82808e-10 10 49
0.491 92.2 0.000686869 98 0.000732851 0.000117944 0.000614906 7.32851e-08 1.17944e-08 6.14906e-08 2.27743e-09 1.58901e-09 6.88424e-10 8 34
];
rows = size(data, 1);
cols = size(data, 2);
data_delay = [];
for i = 1:rows/1,
ifirst = (i - 1) * 1 + 1;
ilast = ifirst + 1 - 1;
tmp = data(ifirst:ilast, cols-14+1);
avg = mean(tmp);
[h sig ci] = ttest(tmp, 0.1);
ci = (ci(2)-ci(1))/2;
data_delay = [data_delay; data(ifirst, 1:cols-14), avg ci]
end
figure(1);title('\color{red} datadelay');
hold on;
plot(data_delay(:,1), data_delay(:,2));
data_throughput = [];
for i = 1:rows/1,
ifirst = (i - 1) * 1 + 1;
ilast = ifirst + 1 - 1;
tmp = data(ifirst:ilast, cols-14+2);
avg = mean(tmp);
[h sig ci] = ttest(tmp, 0.1);
ci = (ci(2)-ci(1))/2;
data_throughput = [data_throughput; data(ifirst, 1:cols-14), avg ci]
end
figure(2);title('\color{red} data throughput');
hold on;
plot(data_throughput(:,1), data_throughput(:,2));
data_maxdelay = [];
for i = 1:rows/1,
ifirst = (i - 1) * 1 + 1;
ilast = ifirst + 1 - 1;
tmp = data(ifirst:ilast, cols-14+3);
avg = mean(tmp);
[h sig ci] = ttest(tmp, 0.1);
ci = (ci(2)-ci(1))/2;
data_maxdelay = [data_maxdelay; data(ifirst, 1:cols-14), avg ci];
end
figure(3);title('\color{red} data_maxdelay');
hold on;
plot(data_maxdelay(:,1), data_maxdelay(:,2));
data_totalenergy = [];
for i = 1:rows/1,
ifirst = (i - 1) * 1 + 1;
ilast = ifirst + 1 - 1;
tmp = data(ifirst:ilast, cols-14+4);
avg = mean(tmp);
[h sig ci] = ttest(tmp, 0.1);
ci = (ci(2)-ci(1))/2;
data_totalenergy = [data_totalenergy; data(ifirst, 1:cols-14), avg ci];
end
figure(4);;title('\color{red} datatotalenergy');
hold on;
plot(data_totalenergy(:,1), data_totalenergy(:,2));
%-------- Saturation Analysis -----------
slope=[];
for i=2:size(data_throughput,1),
slope(i-1) = (data_throughput(i,2)-data_throughput(i-1,2))/(data_throughput(i,1)-data_throughput(i-1,1));
end
for i=2:size(slope,2),
if slope(i) < (0.95*mean(slope(1:i)))
max_pir = data_throughput(i, 1);
max_throughput = data_throughput(i, 2);
min_delay = data_delay(i, 2);
break;
end
end
2 Kommentare
dpb
am 13 Aug. 2020
slope=[];
for i=2:size(data_throughput,1),
slope(i-1) = (data_throughput(i,2)-data_throughput(i-1,2))/(data_throughput(i,1)-data_throughput(i-1,1));
end
is simply
slope=diff(data_throughput(:,2))./diff(data_throughput(:,1));
Use the vectoriized opererators/functions in MATLAB as intended...
As for the Q? re: writing data; use writetable or writematrix
Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!