I'm trying to read in a txt file but MATLAB is only reading in the last column and showing zeros where the other data should be? I checked the txt file and the data is there, and all the values are separated by spaces. Any idea why the first columns are being read in as zeros? My code looks like this:
load ScenarioA.txt; load ScenarioB.txt; ScenarioA

 採用された回答

Star Strider
Star Strider 2017 年 4 月 13 日

0 投票

Your format setting could be the problem. See if setting
format short g
in your script solves the problem.
Example
format short
x = [1E-10 10]
format short g
x = [1E-10 10]
x =
0.0000 10.0000
x =
1e-10 10

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWorkspace 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