importdata() leads to different output for (almost) identical input

2 次查看(过去 30 天)
Hi,
within a script I use the importdata() command to extract certain information from a txt file. Up to now, everything worked fine and as expected: I got a struct with data and textdata with everything I need.
In the meantime, there has been a minor change in the input data (additional lines in the text section). Now I get a cell and therefore the rest of the script does not work anymore as I cannot access the struct.data()
I played around with the input file and figured out that obviously just adding one more character leads to this different behavior (struct vs cell)
So, e.g. the row
"abcdefgh" works (in the sense of giving me a struct) while
"abcdefghi" does not (in the sense of giving me a cell)
To my understanding this seems like there is a limitation of characters.
Is this understanding correct? Is there any workaround?
I attached two files which only differ in line 120. First one results in a struct, second one results in a cell.
The command I use (Matlab R2015b is used) is
importdata('C:\Users\me\Desktop\file_1.txt')
and
importdata('C:\Users\me\Desktop\file_2.txt')
, respectively.
Thank you!
Patrick

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Standard File Formats 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by