Combined 2 files .dat with different size

hello i have 2 files .dat contains enum values but the size of the file one 4000x2 and the second 6000x2 i use "csvread" and "readmatrix" but doesn't work
Note (enum :enumeration)
can you help me pls
thanks

4 件のコメント

Voss
Voss 2024 年 8 月 29 日
Please add both files to a .zip archive, and then upload the .zip file here using the paperclip button.
dpb
dpb 2024 年 8 月 29 日
@Voss has the right suggestion; I'd add to include the code that you tried and whatever error message you received.
younes
younes 2024 年 8 月 29 日
but i want to combine 2 files in one file .dat the Problem it's the Two files has different size
Walter Roberson
Walter Roberson 2024 年 8 月 29 日
I suspect that you will need readtable.
Perhaps something like
T1 = readtable('FirstFileNameGoesHere.dat', 'FileType', 'text');
T2 = readtable('SecondFileNameGoesHere.dat', 'FileType', 'text');
Combined = unique([T1; T2], 'rows');

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

 採用された回答

dpb
dpb 2024 年 8 月 29 日
編集済み: dpb 2024 年 8 月 29 日

1 投票

"but i want to combine 2 files in one file .dat the Problem it's the Two files has different size"
You already told us that, but didn't follow up on either request for further information by showing us what you tried with the error messages you got nor attach the data files (a short section of each would be all that need; whether they're several thousand in length of several tens will not make any difference) so that somebody here could actually do something.
One fairly likely mistake is that you tried something like
A=readmatrix('ThingOne.Dat');
B=readmatrix('ThingTwo.Dat');
C=[A B];
which won't work because you tried to add 6K rows to 4K rows horizontally.
C=[A;B];
would work to give a 10000x2 array.
Presuming the files are valid delimited files that readmatrix can read and that the intent is to combine them into one long file, note that you don't need to create the two temporaries even
E=[readmatrix('ThingOne.Dat'); readmatrix('ThingTwo.Dat')]; % read each and catenate vertically
@Walter Roberson took a reasonable guess; readmatrix might also work
"Help us help you!!!"

1 件のコメント

younes
younes 2024 年 8 月 31 日
thank you very much

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2020b

タグ

質問済み:

2024 年 8 月 29 日

コメント済み:

2024 年 8 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by