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

댓글 수: 1

sudhakar shinde
sudhakar shinde 2018년 5월 8일
Can you please check this ....
https://in.mathworks.com/help/matlab/ref/fscanf.html https://in.mathworks.com/help/matlab/ref/fscanf.html

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

 채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 8일

0 개 추천

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

댓글 수: 2

Marek Majkut
Marek Majkut 2018년 5월 8일
Thank you very much for quick answer. It works excellent.
Ameer Hamza
Ameer Hamza 2018년 5월 8일
편집: Ameer Hamza 2018년 5월 8일
You are welcome.

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

추가 답변 (0개)

질문:

2018년 5월 8일

편집:

2018년 5월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by