Trouble with import text file into Matlab

1 回表示 (過去 30 日間)
Henry
Henry 2016 年 8 月 9 日
コメント済み: Henry 2016 年 8 月 10 日
Hi, Recently, I upgraded from matlab 2012b to matlab 2016a.
I neet to import some data stored in text files into matlab.
There are two columns in each file and are seperated by tab(\t in C).
I just use the Import Data menu.
When I imported the first file, matlab would auto name the first column VarName1 and the second column VarName2.
However, if I import the second file, matlab would name the both columns VarName3
In the old version of Matlab, when I did the same thing, matlab would auto name them VarName3 and VarName4.
I know I could change the name then import the data. But does anyone how what's wrong with that.
Thank you!
  1 件のコメント
dpb
dpb 2016 年 8 月 9 日
Obviously a bug, submit bug report at www.mathworks.com

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

回答 (1 件)

Rob Jacobs
Rob Jacobs 2016 年 8 月 10 日
This is happening because your first import created variables 'VarName1' and 'VarName2' in your workspace. When you open the next file, the Import Tool is avoiding giving the same variable names, because if you imported them a second time, they would overwrite the ones in the workspace. Hence you get 'VarName3' and 'VarName4' instead.
  1 件のコメント
Henry
Henry 2016 年 8 月 10 日
In the Matlab 2012b I used before, I would get a VarName3 and VarName4 for those two columns.
However, In the new version, Matlab 2016a, it would name both columns "VarName3". That is a little annoying.

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

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by