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 Center および File ExchangeGet 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