Reading .txt file of values separated by semicolon
조회 수: 30 (최근 30일)
이전 댓글 표시
Hi,
I'm trying to open a file and put into an array a .txt file that is set up as follows: name1;name2;name3;etc
I tried creating some code that would open this file, read it, and put it into an array. However, it creates a 1x1 array with the entire string of names in one place. Is there a way to splitting these up?
fileName = fopen('data.txt')
C = textscan(fileName, '%s')
댓글 수: 0
채택된 답변
추가 답변 (1개)
the cyclist
2017년 1월 24일
Does this do what you want?
C = textscan(fileName, '%s','Delimiter',';')
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!