how to read read a specific rows in .txt and put it in class?

조회 수: 1 (최근 30일)
Hi. i had 10X10000 matrix in my .txt file. how to read 2 specific rows and put it in one class? below is my coding.
load ('.txt'); %open the .txt file
% Class 1
x1 = [row1];
y1 = [row6];
class1 = [x1 y1];
% Class 2
x2 = [row2];
y2 = [row7];
class2 = [x2 y2];
since my row have 10000 of numbers, its hard to key in the number one by one. Is there any method to scan the row and put it automatically inside the x1,y1,x2,y2?Thanks..
  댓글 수: 5
Walter Roberson
Walter Roberson 2019년 3월 31일
Or
class1 = data([1 6],:);
class2 = data([2 7],:);
EDWARD IJAU PELIAS POG
EDWARD IJAU PELIAS POG 2019년 4월 1일
got it..thanks sir! Have a nice day..

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

채택된 답변

per isakson
per isakson 2019년 3월 31일
The problem is caused by the first character of line 11. It's char(26)
The function readtable() reads the file
Capture.PNG

추가 답변 (0개)

카테고리

Help CenterFile 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!

Translated by