필터 지우기
필터 지우기

Importing dat files as a double matrix

조회 수: 15 (최근 30일)
Mohamed
Mohamed 2023년 12월 4일
댓글: Stephen23 2023년 12월 7일
I am new in matlab, and I got data stored as dat files and I need to import them as a double matrix
Thanks in advance
Mohamed
  댓글 수: 3
Mario
Mario 2023년 12월 4일
I tried to upload one of the files, but the website site refused as they don't support Dat files. I got a set of dat files and they were generated from another Matlab function. each file contains 4 columns (X,Y,U,V)
Voss
Voss 2023년 12월 4일
You can zip the dat file(s) and upload the zip file.

댓글을 달려면 로그인하십시오.

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2023년 12월 4일
편집: KALYAN ACHARJYA 2023년 12월 4일
Example
#Edited (Pls Check Comments)
data = readmatrix('yourfile.dat');
data = double(importdata('yourfile.dat'));
  댓글 수: 6
Mario
Mario 2023년 12월 5일
I used the below command and it read the dat files as a table (1x1500 cell) and each cell include (65536x4 table)
for k = 1:1500
myfilename = sprintf('Vec%05d.dat', k);
mydata{k} = readtable(myfilename);
end
then I tried to convert the table to matrix, but it doesn't work, could you please correct it to me?
for k = 1:1500
mydata1(:,:,k)= table2array(mydata{:,k})
end
Stephen23
Stephen23 2023년 12월 7일
P = 'absolute or relative path to where the files are saved';
N = 1500;
C = cell(1,N);
for k = 1:N
F = sprintf('Vec%05d.dat',k);
C{k} = readmatrix(fullfile(P,F));
end
A = cat(3,C{:});

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by