Read specific column from dat file
Mostra commenti meno recenti
Hi..
I am trying to read a specific colum from dat file however, the output is 1*2 cell array..
I would like the output to be [2;4;5;7;9].. I attached the file and the code as well 

clearvars;
clc;
close all;
fid = fopen('trial_1.dat')
data = textscan(fid, '%d %d[^\n]')
fid = fclose(fid);
% I would like data=[2;4;5;7;9]
Any help please ...
Thanks,
7 Commenti
Mathieu NOE
il 6 Lug 2021
hi
could also share the dat file as well ?
tx
sci hub
il 6 Lug 2021
Mathieu NOE
il 6 Lug 2021
maybe that extension is not supported by this forum, change it to csv or txt and retry
sci hub
il 6 Lug 2021
Mathieu NOE
il 6 Lug 2021
seems a friend has already answered your question below ... you can accept it for sure
Simpler:
T = readtable('trial_1.dat.txt')
T.olx
sci hub
il 9 Lug 2021
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Data Import and Export in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!