フィルターのクリア

Merge matrices into one matrix based on column order

1 回表示 (過去 30 日間)
judy abbott
judy abbott 2016 年 3 月 28 日
コメント済み: judy abbott 2016 年 3 月 28 日
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 件のコメント
Stephen23
Stephen23 2016 年 3 月 28 日
編集済み: Stephen23 2016 年 3 月 28 日
"reading these files allows the matrices creation" How? What code are you using to import them into MATLAB?
judy abbott
judy abbott 2016 年 3 月 28 日
I import them by:
[M,delimiterOut]=importdata('file1.txt')

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

採用された回答

Stephen23
Stephen23 2016 年 3 月 28 日
編集済み: Stephen23 2016 年 3 月 28 日
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.
  1 件のコメント
judy abbott
judy abbott 2016 年 3 月 28 日
These numbered variables are obtained from instrumental measurements (thermometer and pressure gauge) as Output-files (txt format without heading), reading these files allows the matrices creation (Temperature in first column and Pressure in second one) (Time in rows) and the file name indicates the instrument name.
For the matrix A1
# Temperature # Pressure #
Time # 1 # 2 #
Time # 3 # 4 #
The variables arranged to an statistically and plotting futures processus

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by