About importdata(filename) function in Matlab

10 ビュー (過去 30 日間)
GUNJAN AUTI
GUNJAN AUTI 2022 年 5 月 19 日
コメント済み: GUNJAN AUTI 2022 年 5 月 19 日
I have created two .dat files using a same perl script, but on different machines. But when I use importdata(filename) on one file (..mof-177...) it gives a structure as an output, but when I use it on the other file (...mof-5...) it combines all data in a one-dimensional cell. Can someone please explain what might cause this?
I am attching the files along with this message. It is very frustrating to write a different code for each file as I have 1000s of such file to read.

回答 (1 件)

Stephen23
Stephen23 2022 年 5 月 19 日
"I have created two .dat files using a same perl script, but on different machines."
And they have created different files.
"Can someone please explain what might cause this? "
Most likely this non-numeric nonsense here at the end of every line of data:
which clearly does not exist in the other file:
Add nonsense to file, make it harder to parse. So far no surprises here.
  1 件のコメント
GUNJAN AUTI
GUNJAN AUTI 2022 年 5 月 19 日
Oh thanks! It's the copying from differnet machine. Unix to windows eol charachter is creating the problem. Thanks, I didn't think of this before!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by