How to convert txt into mat
조회 수: 2 (최근 30일)
이전 댓글 표시
I've got a problem with conversion txt into mat.
I have tried using this code:
M = csvread('C:\Users\gieni\Desktop\Dane01.txt');
save('C:\Users\gieni\Desktop\Dane01.mat',"M")
but it gives out just one collumn instead of 3 as in txt file.
One of the problems, as i expect is collums are divided only by tab(i mean ' ').
I have no clue how to make it right. Another thing, I'd like to multiply every data from first and 2nd collumn by 1.43, but i couldn't even make it work with 3 collumns, so i haven't started with it yet.
댓글 수: 0
답변 (1개)
VINAYAK LUHA
2022년 6월 8일
HI,
As per Mathworks this documentation csvread is not recommended and readmatrix should be used instead.
M=readmatrix('filepath')
M(:,1:2)=M(:,1:2).*1.43
save('filepath',"M")
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!