Deleting 3rd column of all cell double inside a variable than combine the data together
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Yat Chi
el 25 de Feb. de 2024
Comentada: Star Strider
el 26 de Feb. de 2024
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 comentarios
Respuesta aceptada
Star Strider
el 25 de Feb. de 2024
Editada: Star Strider
el 25 de Feb. de 2024
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.
.
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Reference Applications en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!