MATLAB: Importing .txt matrix

importmatrixtxt

Hello,
I try to import .txt file into matrix double. I used load(), uiimport(), importdata(), readtable(), but none of these commands work. Commands only see it as column and readtable() uses comma delimiter as default instead of \t. I also tried import tool but it also delimites wrong.
I do not use decimal point but decimal coma, and my delimiter is /t. I attached two of my to import files.
My script looks like this:
clc
clear
close all
%data import
%DelimiterIn=' ';
M1=readtable('m1.txt');
M2=importdata('m2.txt');
Thank you very much for your answer.
Marek

Best Answer

Read it using these lines
filetxt = fileread('m1.txt');
filetxt = strrep(filetxt, ',', '.');
data = cell2mat(textscan(filetxt, '%f%f%f%f'))
Related Question