Read matriz from text file

조회 수: 4 (최근 30일)
José Sobrinho
José Sobrinho 2019년 11월 14일
댓글: José Sobrinho 2019년 11월 14일
Hello, i am new to Matlab, and i still coudn't find a way to read a text file, organized like it was a table, and get the matriz in it. The first line of the file are the names of the citys, and rest of the lines are the matriz, wich each position corresponds to the distance between the cities. My objective is to read the cities and put them in an array, and get the matriz with only the numbers;
can someone help me?
Salmorrete, Vila Lo, Piao, Tortolindo, Chao de Frades
0 104 97 33 205
0 0 46 57 410
0 0 0 154 73
0 0 0 0 322
0 0 0 0 0

채택된 답변

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019년 11월 14일
solution:
data=table2array(readtable('yourfilename.txt'))
  댓글 수: 1
José Sobrinho
José Sobrinho 2019년 11월 14일
thanks! That solved my problem

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by