another import from textfile question
显示 更早的评论
dear ladies and gentlemen
of course this frequently occuring questions about data insertion are very annoying to you, i can understand that, but have to put my issue in here... =(
i have a textfile with maaaaaaaaany columns (2 rows and 13000 columns). its generated from a labview program. unfortunately i am not able to code a formatspec for that amount of columns. so cannot manage to make the data import working.
until now, i refered to https://de.mathworks.com/help/matlab/import_export/ways-to-import-text-files.html and the doc help library
the data in my text.file look like this. actually they are seperated by \t ...

but e.q. a .....
filename = 'S:\...\M0905_PK6.txt';
delimiterIn = '\t';
M = importdata(filename, delimiterIn);
...only creates a 2x1 cell where all values are consequentivly written in one cell per row ..

if i'm trying things like that....
...
[A,count] = fscanf(fileID, '%f %f');
...
..how can i handle the formatspec of so many columns.
of course i could transform (transpose, what is my original intention) those files manually with notepad++ e.q. per search and replace but i wanted to script it, maybe additional with a file location prompt later
i'm sending the original file and txtfile enclosed
can someone give me a hint =) ?
kindly regards
Basti
采纳的回答
更多回答(1 个)
Guillaume
2019-1-24
Your file is a simple tab delimited file that is trivially read by csvread or dlmread or readtable:
M = csvread('M0905_PK6.txt')
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import and Export 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

