Deleting 3rd column of all cell double inside a variable than combine the data together

2 ビュー (過去 30 日間)
I got a variable called Pr_error_2, each data represent the pseudorange error of satellites in each second. I would like to delete the 3rd column of all cells double inside the variable. Afterwards combine the data to form something like the expected result. How can I do so? Originally I tried the loop to delete the 3rd column but don’t know why it only deletes 3rd columns in the first data.
In Pr_error_2, the first column inside each cell is the number representing each satellite, second column is the pseudorange error, thrid row is something can be ignored and need to be deleted.

採用された回答

Star Strider
Star Strider 2024 年 2 月 25 日
編集済み: Star Strider 2024 年 2 月 25 日
I limited the run to the first 20 ‘Pr_error_2’ cells because the full set required more time than the 55 second limit here permits, so I ahve not tested it for all of them. I ran it offline (MATLAB Online) for all the cells in ‘Pr_error_2’ and it ran successfully, requiring 108.05 seconds to complete. The full ‘PrJ’ table is (5048x1876) so there are apparently many more satellites than the 25 showin in the first 20.
files = dir('*.mat');
for k = 1:numel(files)
load(files(k).name)
end
% whos
% Pr_error_2
% Pr_error_2{1:5}
Expected_result
Expected_result = 18×6
4.0000 1.2762 1.2721 1.2657 1.2657 1.2571 8.0000 -1.4158 -1.4161 -1.4164 NaN NaN 16.0000 0 0 0 0 0 26.0000 1.3146 1.3146 1.3146 1.3146 1.3146 27.0000 -3.8309 -3.8323 -3.8334 -3.8349 -3.8361 28.0000 2.2691 2.2688 2.2684 2.2680 2.2677 29.0000 NaN NaN NaN NaN 2.5593 31.0000 1.9395 1.9391 1.9390 1.9388 1.9384 32.0000 4.5824 4.5784 4.5739 4.5696 4.5655 89.0000 1.2268 1.2266 1.2265 1.2261 1.2559
Pr_error_2{[1 2 end-1 end]} % Check Data
ans = 17×3
1.0e+04 * 0.0004 0.1276 0.0034 0.0008 -1.4158 0.0014 0.0016 0 0.0066 0.0026 1.3146 0.0054 0.0027 -0.3831 0.0045 0.0028 2.2691 0.0033 0.0031 1.9395 0.0047 0.0032 0.4582 0.0018 0.0089 0.1227 0.0062 0.0093 0 0.0064
ans = 17×3
1.0e+04 * 0.0004 0.1272 0.0034 0.0008 -1.4161 0.0014 0.0016 0 0.0066 0.0026 1.3146 0.0054 0.0027 -0.3832 0.0045 0.0028 2.2688 0.0033 0.0031 1.9391 0.0047 0.0032 0.4578 0.0018 0.0089 0.1227 0.0062 0.0093 0 0.0064
ans = 16×3
1.0e+04 * 0.0008 -1.8709 0.0027 0.0016 0 0.0061 0.0026 1.2043 0.0044 0.0027 -0.6256 0.0061 0.0028 1.5452 0.0027 0.0031 1.4481 0.0044 0.0032 -0.2811 0.0005 0.0087 1.4568 0.0046 0.0088 -0.7967 0.0047 0.0089 0.0826 0.0062
ans = 16×3
1.0e+04 * 0.0008 -1.8711 0.0027 0.0016 0 0.0061 0.0026 1.2038 0.0044 0.0027 -0.6257 0.0061 0.0028 1.5448 0.0027 0.0031 1.4477 0.0044 0.0032 -0.2817 0.0005 0.0087 1.4568 0.0046 0.0088 -0.7967 0.0047 0.0089 0.0826 0.0062
for k = 1:20%numel(Pr_error_2)
PrT{k} = array2table(Pr_error_2{k}(:,[1 2]), 'VariableNames',{'Satellite',sprintf('Error_%04d',k)});
end
PrJ = PrT{1};
for k = 1:numel(PrT)-1
PrJ = outerjoin(PrJ,PrT{k+1},'Keys',1);
end
% PrJ
PrJ = removevars(PrJ, 3:2:size(PrJ,2))
PrJ = 25×21 table
Satellite_PrJ Error_0001 Error_0002 Error_0003 Error_0004 Error_0005 Error_0006 Error_0007 Error_0008 Error_0009 Error_0010 Error_0011 Error_0012 Error_0013 Error_0014 Error_0015 Error_0016 Error_0017 Error_0018 Error_0019 Error_0020 _____________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ __________ 4 1276.2 1272.1 1265.7 1260.7 1257.1 1248.9 1245.7 1240.3 1237.3 1233.7 1231.7 1230.2 1229.3 1223.4 1218 1215.9 1212.8 1209.2 NaN NaN 8 -14158 -14161 -14164 NaN NaN NaN -14182 -14186 -14189 -14188 -14190 -14189 -14190 -14193 -14196 -14197 -14200 -14199 -14199 -14202 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 26 13146 13146 13146 13146 13146 13146 13145 13145 13146 13145 13145 13145 13145 13145 13145 13144 13144 13144 13144 13143 27 -3830.9 -3832.3 -3833.4 -3834.9 -3836.1 -3837.7 -3838.9 -3840.1 -3841.1 -3842.6 -3843.9 -3845 -3846.1 -3847.6 -3848.6 -3850.2 -3851.3 -3852.9 -3854.3 -3855.9 28 22691 22688 22684 22680 22677 22673 22670 22666 22663 22659 22656 22653 22650 22647 22643 22640 22637 22634 22630 22627 31 19395 19391 19390 19388 19384 19379 19382 19382 19379 19374 19372 19371 19368 19367 19365 19361 19358 19358 19355 19355 32 4582.4 4578.4 4573.9 4569.6 4565.5 4561.3 4557.1 4552.5 4548.4 4544.4 4540.2 4536.1 4531.9 4527.7 4523.8 4519.6 4515.8 4511.6 4507.5 4503.2 89 1226.8 1226.6 1226.5 1226.1 1225.9 1226 1226 1225.7 1225.4 1225.4 1224.9 1224.2 1224 1223.8 1223.7 1223.7 1223.7 1223.5 1223.4 1223.5 93 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 95 12539 12540 12540 12540 12540 12541 12541 12541 12541 12541 12541 12541 12541 12541 12541 12541 12541 12542 12542 12543 96 -4207.6 -4207.5 -4207.7 -4207.9 -4207.8 -4207.5 -4207.5 -4207.6 -4208 -4208.3 -4208.7 -4209.4 -4209.7 -4209.5 -4209.1 -4209.5 -4209.4 -4209.3 -4209 -4208.9 97 10845 10846 10848 10849 10851 10853 10855 10857 10858 10859 10861 10862 10863 10865 10867 10868 10870 10870 10874 10874 98 27899 27900 27901 27902 27903 27904 27905 27906 27907 27908 27909 27909 27909 27910 27911 27912 27913 27914 27915 27916 100 -1344.6 -1345 -1345.1 -1345.2 -1345.1 -1344.7 -1344.9 -1345.1 -1345.6 -1345.7 -1346.2 -1346.9 -1347.2 -1347.5 -1347.2 -1347.4 -1347.3 -1347 -1347.4 -1347.6 102 17405 17404 17404 17404 17404 17404 17403 17403 17403 17403 17402 17401 17401 17400 17400 17400 17400 17400 17400 17400
There is of course nothing specific about the names I chose.
EDIT — (25 Feb 2024 at 17:35)
The variable names I chose allow straightforward tracking of different variables to their associated original cell arrays. To convert the ‘PrJ’ table to a matrix, use the table2array function.
.
  4 件のコメント
Yat Chi
Yat Chi 2024 年 2 月 26 日
Ah, that works perfectly!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by