concatenating the rows to have a column wise data
5 次查看(过去 30 天)
显示 更早的评论
Kushal Bhalla
2021-5-23
In the attached data set, the rows provide daily information at a fifteen minute interval for a set of 9 variables for 31 days of January. Is there an easy way to rearrage this data, so I have 9 variables as columns and their sequence of observations for the entire month as rows. Please help!
采纳的回答
DGM
2021-5-23
This could almost certainly be simplified, but I think this is at least readable:
% data arranged as groups of 4 row vectors
A = [1:10; 101:110; 201:210; 301:310; 11:20; 111:120; 211:220; 311:320]
% rearrange
B = [reshape(A(1:4:end,:).',[],1) ...
reshape(A(2:4:end,:).',[],1) ...
reshape(A(3:4:end,:).',[],1) ...
reshape(A(4:4:end,:).',[],1)]
The webpage truncates the final output here, but it does continue in a column vector format.
8 个评论
Kushal Bhalla
2021-5-24
Vow! This is amazing. I am elated. Such a succinct and an ingenious way of reorganizing data. Absolutely liked ur response, illustration, and solution. This really addresses my problem completely. I had been struggling with long pieces of code to reach the same endpoint. Sir, you have done it in just few lines of code. Excellent! Great! Really appreciate!
Kushal Bhalla
2023-11-20
Sir,
I had been trying to use your code to the attached data set. In order to get only the table values, I had deleted the first row and also the first column. However, I am getting the following error:
"Undefined function 'transpose' for input arguments of type 'table'. Use the ROWS2VARS function instead."
Could you please have a look.
Thanks
DGM
2023-11-21
编辑:DGM
2023-11-21
Afaik, operations like transpose(), reshape() don't work on tables. In the given example, they're just working on numeric arrays.
A = readmatrix('data.csv'); % read into a numeric array
A = A(:,2:end); % changed
cols = 9; % number of output columns
A = reshape(A.',size(A,2),cols,[]);
A = permute(A,[1 3 2]);
A = reshape(A,[],cols)
A = 2976×9
1.0e+03 *
0.0083 2.5167 0.1137 1.4888 0.0077 0.9481 0.0045 0 1.5426
0.0076 2.4847 0.1129 1.4897 0.0074 0.9485 0.0045 0 1.5551
0.0073 2.4823 0.1155 1.5114 0.0074 0.9483 0.0045 0 1.5129
0.0073 2.4699 0.1146 1.4869 0.0074 0.9485 0.0044 0 1.5282
0.0073 2.4487 0.1144 1.4784 0.0073 0.9486 0.0045 0 1.5053
0.0074 2.4417 0.1142 1.4680 0.0073 0.9485 0.0044 0 1.4814
0.0078 2.3994 0.1122 1.4474 0.0073 0.9483 0.0045 0 1.5047
0.0080 2.3620 0.1124 1.4751 0.0073 0.9484 0.0045 0 1.4768
0.0082 2.3483 0.1120 1.4686 0.0073 0.9482 0.0044 0 1.4545
0.0080 2.2819 0.1121 1.4672 0.0073 0.9482 0.0043 0 1.4772
Kushal Bhalla
2023-11-21
Sir,
31 * 96 = 2976. Therefore, ''A'' should be 2976 * 9. How come we got 2852 * 9?
We can get rid of the first column which is more like an id. The first row serves as a header. Perhaps that is required. Isn't it?
Apart from these all other entries can be kept the way they are.
A question about, A = A(:,2:end-4)......here are we getting rid of some columns? If NaNs appear as an observation value then we may keep it to be handled later on.
Thanks
Appreciate your help!
DGM
2023-11-21
编辑:DGM
2023-11-21
Oh that's just great. The behavior of readmatrix() differs between versions, so it returns a different size output than I was getting. That's why it's wrong. I'll fix it in a minute.
There is one column denoting date and category. There are four trailing columns containing empty chars. When converted to numeric, all five of these columns will become NaN. In R2019b, all five columns are preserved. In R2023b, apparently only some of them are. The trailing columns get discarded in the newer version, so attempting to discard them manually was truncating the data.
Kushal Bhalla
2023-11-21
编辑:Kushal Bhalla
2023-11-21
Great! This ran well.
Sir, I have another dataset jan13.xlsx (attached). It has one additional column of total. I tried to change the code to get rid of that as follows (starting from 3 instead of 2):
A = readmatrix('jan13.xlsx'); % read into a numeric array
A = A(:,3:end); % changed
cols = 9; % number of output columns
A = reshape(A.',size(A,2),cols,[]);
A = permute(A,[1 3 2]);
A = reshape(A,[],cols)
but got the following error message:
Error using reshape
Product of known dimensions, 864, not divisible into total number of elements, 26880.
Error in (line 4)
A = reshape(A.',size(A,2),cols,[]);
DGM
2023-11-22
readmatrix() is picking up the time headers as data, so row 1 needs to be omitted.
A = A(2:end,3:end);
Stuff like readmatrix() and readtable() might be conveniences, but it pays to make sure it's picking up the file like you expect.
Kushal Bhalla
2023-11-22
Great Sir! this worked.
Sir, in another dataset (attached) the same information (biomass, coal, gas, gas cc, hydro, nuclear, other, solar, wind) is presented in a different manner (days for each fuel clubbed separately). However, I am interested in the same final output of 9 columns and 2976 rows. Could you please have a look? Shall be grateful for your help.
更多回答(1 个)
Stephen23
2023-11-22
编辑:Stephen23
2023-11-23
The MATLAB approach:
T = readtable('data.csv', 'VariableNamingRule','Preserve')
T = 279×97 table
Date-Fuel 0:15 0:30 0:45 1:00 1:15 1:30 1:45 2:00 2:15 2:30 2:45 3:00 3:15 3:30 3:45 4:00 4:15 4:30 4:45 5:00 5:15 5:30 5:45 6:00 6:15 6:30 6:45 7:00 7:15 7:30 7:45 8:00 8:15 8:30 8:45 9:00 9:15 9:30 9:45 10:00 10:15 10:30 10:45 11:00 11:15 11:30 11:45 12:00 12:15 12:30 12:45 13:00 13:15 13:30 13:45 14:00 14:15 14:30 14:45 15:00 15:15 15:30 15:45 16:00 16:15 16:30 16:45 17:00 17:15 17:30 17:45 18:00 18:15 18:30 18:45 19:00 19:15 19:30 19:45 20:00 20:15 20:30 20:45 21:00 21:15 21:30 21:45 22:00 22:15 22:30 22:45 23:00 23:15 23:30 23:45 0:00
____________________ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______
{'01/01/12-Biomass'} 8.3 7.61 7.32 7.32 7.32 7.43 7.83 7.98 8.19 7.97 7.31 7.63 7.94 8.04 8.23 8.13 8.14 8.14 8.08 7.78 7.79 7.8 7.78 7.8 7.86 7.86 7.88 7.88 7.87 7.87 7.84 7.87 7.86 7.72 6.92 6.96 6.96 6.95 6.95 6.96 6.92 6.69 6.55 6.92 7.76 7.91 7.9 7.92 7.9 7.95 8.02 8.21 8.35 8.36 8.35 8.37 8.35 8.36 8.27 8.34 8.34 8.35 7.76 7.7 7.74 7.77 8.03 8.14 8.07 8.08 8.08 7.9 7.77 7.79 7.81 7.82 7.9 8.07 8.23 8.3 8.39 8.39 8.39 8.39 8.38 8.39 8.35 8.31 8.29 8.18 8.16 8.15 8.16 8.15 8.15 8.16
{'01/01/12-Coal' } 2516.7 2484.7 2482.2 2469.9 2448.7 2441.7 2399.4 2362 2348.3 2281.9 2267.7 2260.9 2303.9 2364.2 2391.6 2418.5 2440.7 2454.6 2483.8 2493.2 2551.9 2590.1 2607.8 2612.4 2628.5 2658.9 2699.8 2768.6 2838.6 2865.1 2882.2 2868.2 2877.2 2905.7 2939.3 2984.7 3025.6 3093.7 3158.1 3189.4 3201.1 3181.6 3159.8 3171.9 3216.9 3285.5 3316.5 3314.4 3335.3 3355 3360.7 3367.1 3351.9 3335.1 3320 3286.9 3249 3217.2 3164.1 3101.4 3062.4 3065.1 3058.8 3040.2 3014.3 2999.9 2993.9 3007.4 3027.6 3075.6 3149.7 3294.8 3431.3 3550 3624.3 3661.5 3665.4 3671.4 3672.8 3683.8 3673.3 3656.4 3631.7 3600.6 3600.6 3599.9 3585.5 3563.5 3523 3472.7 3417.7 3371.5 3343.4 3306.1 3221.7 3155.8
{'01/01/12-Gas' } 113.68 112.89 115.51 114.61 114.45 114.15 112.18 112.38 111.97 112.09 111.97 112.01 113.25 115.19 114.8 113.99 114.09 114.49 114.63 114.73 114.86 114.69 114.95 115.5 124.97 129 130.38 130.69 131.64 132.81 137.65 160.1 162.15 163.01 162.42 162.04 161.6 161.04 160.67 158.79 157.86 157.65 157.8 157.83 158.05 157.99 157.55 157.49 156.33 151.3 141.53 132.57 129.07 128.82 131.3 148.69 149.75 130.9 130.71 131.19 130.65 130.58 131.18 132.23 132.27 132.32 132.75 131.9 132.75 133.04 133.19 137.81 137.81 137.72 138.06 139.51 139.78 140.74 140.51 140.09 138.53 135.05 135.01 134.71 134.74 135.24 135.03 135.18 129.49 124.3 125.63 125.51 125.63 125.77 126.2 126.42
{'01/01/12-Gas_CC' } 1488.8 1489.7 1511.4 1486.9 1478.4 1468 1447.4 1475.1 1468.6 1467.2 1464.5 1489.3 1528.5 1507.1 1498.4 1486.8 1467.1 1494.8 1461.7 1479.7 1529.7 1522 1524.3 1524.6 1544.5 1581.1 1653.4 1724.7 1776.8 1794.6 1825.1 1830.7 1875.5 1924.3 1996.8 2089.6 2194.3 2236.3 2243.1 2235.5 2236.4 2232.1 2251.2 2272.3 2297.8 2305.8 2316.3 2337.8 2343.7 2332.9 2335.6 2326.9 2308.9 2304.9 2305.4 2292.9 2300.4 2296 2298.6 2323.6 2332.3 2342.2 2343.3 2352.4 2383 2413.1 2440.1 2482.3 2572.6 2668.6 2828.8 2980 3052.5 3040.1 3017.8 3008.2 3029.7 3026.1 3012.2 2963.9 2947.9 2940 2926.2 2922.9 2923.5 2897.3 2878.5 2853.8 2821.1 2808.2 2794.9 2773 2705.9 2633.7 2614.4 2592
{'01/01/12-Hydro' } 7.67 7.37 7.38 7.37 7.35 7.34 7.34 7.35 7.34 7.34 7.35 7.34 7.33 7.33 7.32 7.32 7.33 7.32 7.32 7.32 7.53 7.68 7.9 7.93 10.26 10.42 10.39 10.12 8.41 8.38 8.38 8.41 8.42 8.46 8.44 8.46 8.45 8.45 8.44 8.45 8.45 8.47 8.47 8.49 7.97 7.64 7.65 7.63 7.42 7.4 7.41 7.41 7.41 7.43 7.42 7.44 7.42 7.43 7.42 7.41 7.42 7.41 7.41 7.42 7.41 7.41 7.41 7.47 12.73 13.04 13.08 13.26 21.69 27.86 29.84 29.95 16.21 16.23 16.22 16.23 16.23 16.24 16.23 16.23 16.21 16.23 16.21 16.22 16.24 16.22 16.22 16.22 16.13 16.25 16.26 16.25
{'01/01/12-Nuclear'} 948.15 948.48 948.29 948.51 948.55 948.45 948.3 948.41 948.19 948.16 948.24 948.25 948.18 948.15 948.23 947.98 948.19 948.25 948.35 948.32 948.27 948.28 948.26 948.29 948.35 948.32 948.28 948.29 948.32 948.31 948.44 948.53 948.56 948.64 948.64 948.78 948.64 948.73 948.84 948.87 948.69 948.84 948.77 948.88 948.85 948.96 949.03 949.02 949.12 949.04 949.05 949.01 949.13 949.23 949.16 949.27 949.2 949.25 949.22 949.23 949.19 949.23 949.4 949.35 949.25 949.25 949.35 949.18 949.25 949.17 949.35 949.3 949.23 948.92 948.89 948.88 948.93 948.89 948.88 948.88 948.94 949.07 948.96 948.83 948.73 948.75 948.82 948.87 948.85 948.75 948.83 948.76 948.73 948.79 948.92 948.9
{'01/01/12-Other' } 4.46 4.46 4.46 4.45 4.46 4.45 4.46 4.46 4.44 4.26 2.5 2.39 2.39 2.39 2.39 2.39 2.4 2.4 2.4 2.4 2.4 2.41 2.52 2.61 2.61 2.6 2.44 2.24 2.24 2.25 2.27 2.5 2.45 2.59 3.59 4.1 4.14 4.11 4.17 4.19 4.18 4.18 4.18 4.18 4.18 4.18 4.21 4.22 4.1 4.05 4.05 4.05 4.05 4.05 4.03 4.04 3.98 3.99 3.91 3.84 4 4.06 4.07 4.07 4.07 4.07 4.07 4.01 3.7 3.71 3.72 3.71 3.81 3.9 3.9 3.9 4.09 4.28 4.14 4.12 4.12 4.12 4.12 4.12 4.12 4.12 4.11 4.11 4.11 4.11 4.12 4.12 4.12 4.12 4.13 4.15
{'01/01/12-Sun' } 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0.28 0.54 0.9 1.13 1.44 1.72 1.98 2.24 2.44 2.65 2.84 2.99 3.13 3.39 3.87 3.94 3.96 4.23 4.33 4.31 4.31 4.09 3.9 3.99 3.92 3.83 3.77 3.7 3.67 3.55 3.41 3.06 2.82 2.55 2.15 1.71 1.25 0.81 0.39 0.04 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{'01/01/12-Wind' } 1542.6 1555.1 1512.9 1528.2 1505.3 1481.4 1504.7 1476.8 1454.5 1477.2 1438.1 1403.5 1364.7 1313.8 1284.8 1261 1237.5 1193 1167.7 1153.7 1128.5 1114.3 1118.5 1145.5 1171.2 1157 1113.9 1031.9 983.18 922.89 871.57 905.97 940.42 923.47 871.42 774.84 688.59 629.18 585.37 576.44 596.76 622.94 616.71 570.39 501.69 433.77 387.3 354.04 317.79 296.46 279.98 265.16 270.85 267.46 259.86 255.24 249.19 271.23 290.11 299.32 314.01 309.58 306.85 309.33 306.45 305.53 315.72 311.5 297.9 294.22 281.74 281.37 281.92 289.4 294.04 289.97 291.56 303.22 325.99 354.73 371.49 398.13 425.37 446.04 451.23 442.77 427.97 420.32 427.56 436.19 447.92 450.96 455.02 475.62 497.16 506.87
{'01/02/12-Biomass'} 8.16 8.17 8.17 8.16 8.17 8.16 8.17 8.17 8.18 8.17 8.17 8.18 8.19 8.19 8.19 8.18 8.2 8.2 8.19 8.22 8.17 8.19 8.16 8.12 8.02 8.01 8.01 8.03 8.01 8.04 8.02 7.9 7.85 7.84 7.84 7.83 7.83 7.84 7.82 7.8 7.79 7.8 7.78 7.8 7.79 7.8 7.37 6.94 6.93 6.99 7.43 7.76 7.8 7.79 7.8 7.79 7.79 7.78 6.82 7.14 7.75 8.03 7.95 7.81 7.87 7.77 7.78 7.73 7.73 7.88 8.06 8.05 8.06 8.06 8.07 8.01 7.45 7.08 7.08 7.33 7.61 7.78 7.77 8 8.14 8.14 8.13 8.13 8.14 8.14 8.13 8.15 8.12 8.09 8.07 8.07
{'01/02/12-Coal' } 3091.6 3055.1 3028.4 3004.9 3001.6 3008.4 2996.2 2990.7 2992 3007.5 3010.9 3013.1 3029 3053 3084 3126.8 3161.9 3178 3188.4 3206.6 3236.4 3259.6 3288.2 3354.2 3350.2 3380.6 3427.1 3508.2 3594.9 3623.7 3636.3 3639.4 3624 3619.7 3634.3 3654.7 3700.3 3721.9 3710.9 3700.4 3715.1 3719 3726.2 3710.8 3697 3700.1 3654.1 3610.2 3585.3 3580.7 3531 3498.2 3438.4 3389.9 3348.9 3301.6 3250.9 3211.8 3175 3137.1 3061.4 3030.2 3011.1 3008.7 3001.4 3042.8 3063.2 3061 3117.2 3228.4 3388.7 3569.3 3683.7 3742.3 3756.7 3758.4 3766.6 3771.4 3770.8 3772.7 3776.3 3787.1 3783.8 3777.3 3755.6 3730 3696.1 3675.1 3657.9 3607.2 3548.8 3577.1 3540.4 3484.6 3356.7 3251.6
{'01/02/12-Gas' } 127.54 127.59 127.05 127.32 127.66 128.16 128.12 128.12 128.08 128.15 128.63 128.93 128.25 128.04 127.58 127.86 128.38 128.35 127.91 128.22 128.56 127.95 127.36 127.85 140.34 141.18 140.24 140.51 141.41 150.95 149.77 149.23 149.62 146.11 143.88 143.82 141.49 140.14 139.27 139.62 139.5 138.54 139.03 138.72 138.11 137.75 137.39 137.54 136.9 136.92 137.64 136.79 137.23 137.65 137.24 137.29 137.05 136.7 137.43 137.34 137.59 136.9 136.39 137.77 139.16 137.45 139.96 141.62 143.41 143.64 144.84 159.94 176.45 181.64 191.44 197.93 197.73 194 193.18 193.22 197.99 199.26 197.04 194.71 189.21 170.29 153.59 147.64 141.36 133.68 132.93 127.27 125.76 125.84 126.91 127.15
{'01/02/12-Gas_CC' } 2602.7 2610 2603.2 2598.2 2592.7 2573.3 2575.6 2572.7 2587.6 2586.1 2584.8 2600.6 2626.3 2634.9 2650.7 2646.1 2681.3 2706.6 2760.9 2818.1 2949.2 3034.8 3117 3165.2 3382.3 3496.3 3579.5 3642.9 3694.8 3679.9 3663 3660.9 3687.1 3712.6 3741.1 3760.5 3781.6 3792.7 3791.2 3788.9 3795.5 3749.3 3711.9 3660.9 3649.1 3614.8 3622.3 3614.6 3658.1 3623.5 3611.2 3575.1 3543.9 3541.8 3533.4 3506.4 3485.4 3493.2 3461.2 3467.8 3408 3420.8 3418.8 3425 3419.9 3498.6 3466 3521.6 3543.7 3601.7 3725.9 3898.5 3936.5 4037.6 4053.8 4111.1 4101.9 4129.9 4143.6 4151.7 4171 4165.5 4161.2 4133.4 4083.2 4057 4026.1 3912.8 3768 3651.1 3593.1 3437.3 3457 3408.3 3352.2 3351.6
{'01/02/12-Hydro' } 15.44 15.15 15.15 15.15 15.11 15.02 14.51 7.35 7.35 7.35 7.36 7.35 7.34 7.34 7.3 7.32 7.33 7.33 7.32 7.31 7.43 7.43 7.43 7.45 9.48 10.49 10.49 10.52 8.81 8.4 8.41 8.4 8.45 8.47 8.47 8.45 8.44 8.44 8.45 8.48 8.47 8.45 8.47 8.48 8.49 8.47 7.84 7.62 7.4 7.34 7.38 7.36 7.32 7.33 7.31 7.8 14.76 14.79 14.8 14.79 14.83 14.79 14.81 14.79 14.83 7.52 14.17 15.05 20.02 20.86 20.88 20.89 21.02 21.02 21.16 21.05 21.12 21.16 21.27 21.15 16.26 16.29 16.2 16.15 16.24 16.24 15.99 8.51 8.46 8.46 8.45 8.48 8.45 8.44 8.47 8.47
{'01/02/12-Nuclear'} 948.9 948.88 948.92 949.03 948.95 948.93 949 948.91 948.97 948.99 949.04 949.24 949.21 949.15 949.04 949.17 949.22 949.19 949.18 949.37 949.47 949.07 949.08 948.99 949.33 949.02 949.1 948.98 949.16 949.03 949.05 949.06 949.03 948.85 948.97 949.08 949.12 949.25 949.17 949.29 949.22 949.09 949.32 949.3 949.26 949.2 949.3 949.3 949.31 949.22 949.53 949.36 949.54 949.61 949.4 949.63 949.39 949.44 949.48 949.59 949.72 949.43 949.75 949.53 949.68 949.6 949.78 949.79 949.73 949.91 949.79 949.6 949.56 949.58 949.62 949.61 949.69 949.64 949.55 949.48 949.49 949.49 949.35 949.29 949.59 949.44 949.27 949.33 949.38 949.29 948.93 949.5 949.16 949.01 949.16 949.11
{'01/02/12-Other' } 3.94 3.81 3.82 3.82 3.82 3.82 3.82 3.82 3.82 3.82 3.83 3.83 3.82 3.82 3.82 3.81 3.82 3.81 3.82 3.81 3.56 3.48 3.46 3.45 3.44 3.43 3.45 3.45 3.45 3.46 3.46 3.46 3.57 3.64 3.64 3.65 3.61 3.13 3.17 3.26 3.64 3.66 3.67 3.74 3.73 3.98 3.99 3.99 3.99 3.99 3.99 4 4.1 4.17 4.17 4.17 4.04 3.99 3.99 3.99 3.99 3.99 4 3.99 3.99 3.99 3.99 3.99 3.98 3.99 3.98 3.97 3.98 3.98 3.99 3.98 3.98 3.98 3.98 3.97 4.09 4.14 3.92 3.81 3.81 3.82 3.81 3.83 3.98 3.98 3.98 3.98 3.97 3.97 3.97 3.96
P = digitsPattern+":"+digitsPattern;
U = stack(T, P, 'NewDataVariableName','Data', 'IndexVariableName','QuarterHours')
U = 26784×3 table
Date-Fuel QuarterHours Data
____________________ ____________ ____
{'01/01/12-Biomass'} 0:15 8.3
{'01/01/12-Biomass'} 0:30 7.61
{'01/01/12-Biomass'} 0:45 7.32
{'01/01/12-Biomass'} 1:00 7.32
{'01/01/12-Biomass'} 1:15 7.32
{'01/01/12-Biomass'} 1:30 7.43
{'01/01/12-Biomass'} 1:45 7.83
{'01/01/12-Biomass'} 2:00 7.98
{'01/01/12-Biomass'} 2:15 8.19
{'01/01/12-Biomass'} 2:30 7.97
{'01/01/12-Biomass'} 2:45 7.31
{'01/01/12-Biomass'} 3:00 7.63
{'01/01/12-Biomass'} 3:15 7.94
{'01/01/12-Biomass'} 3:30 8.04
{'01/01/12-Biomass'} 3:45 8.23
{'01/01/12-Biomass'} 4:00 8.13
C = split(U.('Date-Fuel'),'-');
D = strcat(C(:,1),'_',cellstr(U.QuarterHours));
U.Fuel = C(:,2);
U.Date = datetime(D,'InputFormat','d/M/yy_HH:mm', 'Format','yyyy-MM-dd HH:mm')
U = 26784×5 table
Date-Fuel QuarterHours Data Fuel Date
____________________ ____________ ____ ___________ ________________
{'01/01/12-Biomass'} 0:15 8.3 {'Biomass'} 2012-01-01 00:15
{'01/01/12-Biomass'} 0:30 7.61 {'Biomass'} 2012-01-01 00:30
{'01/01/12-Biomass'} 0:45 7.32 {'Biomass'} 2012-01-01 00:45
{'01/01/12-Biomass'} 1:00 7.32 {'Biomass'} 2012-01-01 01:00
{'01/01/12-Biomass'} 1:15 7.32 {'Biomass'} 2012-01-01 01:15
{'01/01/12-Biomass'} 1:30 7.43 {'Biomass'} 2012-01-01 01:30
{'01/01/12-Biomass'} 1:45 7.83 {'Biomass'} 2012-01-01 01:45
{'01/01/12-Biomass'} 2:00 7.98 {'Biomass'} 2012-01-01 02:00
{'01/01/12-Biomass'} 2:15 8.19 {'Biomass'} 2012-01-01 02:15
{'01/01/12-Biomass'} 2:30 7.97 {'Biomass'} 2012-01-01 02:30
{'01/01/12-Biomass'} 2:45 7.31 {'Biomass'} 2012-01-01 02:45
{'01/01/12-Biomass'} 3:00 7.63 {'Biomass'} 2012-01-01 03:00
{'01/01/12-Biomass'} 3:15 7.94 {'Biomass'} 2012-01-01 03:15
{'01/01/12-Biomass'} 3:30 8.04 {'Biomass'} 2012-01-01 03:30
{'01/01/12-Biomass'} 3:45 8.23 {'Biomass'} 2012-01-01 03:45
{'01/01/12-Biomass'} 4:00 8.13 {'Biomass'} 2012-01-01 04:00
V = unstack(U,'Data','Fuel', 'GroupingVariables','Date')
V = 1152×10 table
Date Biomass Coal Gas Gas_CC Hydro Nuclear Other Sun Wind
________________ _______ ______ ______ ______ _____ _______ _____ ___ ______
2012-01-01 00:15 8.3 2516.7 113.68 1488.8 7.67 948.15 4.46 0 1542.6
2012-01-01 00:30 7.61 2484.7 112.89 1489.7 7.37 948.48 4.46 0 1555.1
2012-01-01 00:45 7.32 2482.2 115.51 1511.4 7.38 948.29 4.46 0 1512.9
2012-01-01 01:00 7.32 2469.9 114.61 1486.9 7.37 948.51 4.45 0 1528.2
2012-01-01 01:15 7.32 2448.7 114.45 1478.4 7.35 948.55 4.46 0 1505.3
2012-01-01 01:30 7.43 2441.7 114.15 1468 7.34 948.45 4.45 0 1481.4
2012-01-01 01:45 7.83 2399.4 112.18 1447.4 7.34 948.3 4.46 0 1504.7
2012-01-01 02:00 7.98 2362 112.38 1475.1 7.35 948.41 4.46 0 1476.8
2012-01-01 02:15 8.19 2348.3 111.97 1468.6 7.34 948.19 4.44 0 1454.5
2012-01-01 02:30 7.97 2281.9 112.09 1467.2 7.34 948.16 4.26 0 1477.2
2012-01-01 02:45 7.31 2267.7 111.97 1464.5 7.35 948.24 2.5 0 1438.1
2012-01-01 03:00 7.63 2260.9 112.01 1489.3 7.34 948.25 2.39 0 1403.5
2012-01-01 03:15 7.94 2303.9 113.25 1528.5 7.33 948.18 2.39 0 1364.7
2012-01-01 03:30 8.04 2364.2 115.19 1507.1 7.33 948.15 2.39 0 1313.8
2012-01-01 03:45 8.23 2391.6 114.8 1498.4 7.32 948.23 2.39 0 1284.8
2012-01-01 04:00 8.13 2418.5 113.99 1486.8 7.32 947.98 2.39 0 1261
Having your data arranged this way will make it much easier to work with. For example:
format compact
summary(V)
Variables:
Date: 1152×1 datetime
Values:
Min 2012-01-01 00:00
Median 2012-06-16 11:52
Max 2012-12-01 23:45
Biomass: 1152×1 double
Values:
Min 4.82
Median 8.035
Max 12.77
Coal: 1152×1 double
Values:
Min 2096.2
Median 2960.2
Max 3824.8
Gas: 1152×1 double
Values:
Min 111.27
Median 149.76
Max 602.92
Gas_CC: 1152×1 double
Values:
Min 1447.4
Median 3269.1
Max 5354.2
Hydro: 1152×1 double
Values:
Min 6.89
Median 8.11
Max 30.04
Nuclear: 1152×1 double
Values:
Min 906.21
Median 948.55
Max 951.15
Other: 1152×1 double
Values:
Min 1.29
Median 4.11
Max 5.29
Sun: 1152×1 double
Values:
Min 0
Median 0
Max 8.44
Wind: 1152×1 double
Values:
Min 8.82
Median 900.15
Max 1746.1
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geographic Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)