Merge matrices into one matrix based on column order
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
judy abbott
el 28 de Mzo. de 2016
Comentada: judy abbott
el 28 de Mzo. de 2016
Hy All, I'm new Matlab user i need to merge/interlace/combine a number of matrix in one , i have fond on network
A1 =[1 2;
3 4]
A2 =[5 6;
7 8]
MA = reshape([A1;A2],size(A1,1),[])
MA =
1 5 2 6
3 7 4 8
Can any on help me to generalised it fo n Matrix of course with the same dimension (rows and columns), i need to generalise it for n number (a loop , for i :1 to n), best regards
4 comentarios
Respuesta aceptada
Stephen23
el 28 de Mzo. de 2016
Editada: Stephen23
el 28 de Mzo. de 2016
You don't tell us anything about how you are reading these file into MATLAB, so here is a general overview of how to solve your original question:
% read the file data into a cell array:
N = {list of filenames};
C = cell(1,numel(N));
for k = 1:numel(N)
C{k} = csvread(N{k});
end
% concatenate data and rearrange:
M = vertcat(C{:});
out = reshape(M,2,[])
You also did not define exactly what you mean by "interlace", but once you have all of the data in one matrix M it is easy to experiment with reshape.
Más respuestas (0)
Ver también
Categorías
Más información sobre Particle & Nuclear Physics 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!