Filter löschen
Filter löschen

Load function not properly loading a numeric ASCII file

2 Ansichten (letzte 30 Tage)
Eric Metzger
Eric Metzger am 27 Sep. 2018
Kommentiert: Star Strider am 15 Okt. 2018
I am trying to load and ASCII file that is 24X48. The load function will not load the load the actual values in the work space. It will load zeros. The "readtable" will work without a problem but it puts in format has to be converted into an array and can only be done after individual values are pulled out, put into a 1X1 table then converted into an array. I am using R2018a at this time. I never had this problem with my old version R2008b.
Is there a way to use the load function on a ASCII file that is in the form of a table that will not cause this issue?
Ideally, I need a function that can load in an ASCII file into the workspace as an array quickly without jumping through hoops and allow the data to be either a character or an integer or number?
  9 Kommentare
Star Strider
Star Strider am 29 Sep. 2018
The load function imported it correctly when I tried it. (See my Answer.)
Walter Roberson
Walter Roberson am 29 Sep. 2018
I just tried it on R2018a on Windows 10. load() worked fine for me. I did have to use
format long g
to be able to see the full range of values.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 29 Sep. 2018
Your file is (24 x 47), and load reads it correctly and completely:
D = load('20180919N.txt');
I copied your entire file to my workspace, as well as imported it with load, then did a logical test for equality between the two matrices. The two matrices are the same.
  8 Kommentare
Eric Metzger
Eric Metzger am 15 Okt. 2018
Wanted to thank all that contributed to this question. While I have used MatLab in the past, I am not just getting back into it and some of the simple issues like format I am having to relearn. Would have posted this sooner but I have been dealing with a number of issues. This is the first chance I have had to get back to this. This did work and it is now a standard in my scripts.
Star Strider
Star Strider am 15 Okt. 2018
Our pleasure.
MATLAB has changed over the years, and even between R2018a and 2018b. See the Release Notes (link) for a release-by-release synopsis. It now also has a search function.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by