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.
0 个评论
采纳的回答
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
Pr_error_2{[1 2 end-1 end]} % Check Data
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))
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.
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Reference Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!