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 Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

질문:

2017년 4월 13일

답변:

2017년 4월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by