Why does UIIMPORT in MATLAB 7.0 (R14) retrieve the wrong data columns when putting data into vectors?

3 views (last 30 days)
I have tab-delimited data with column names and I would like to import certain columns into MATLAB. I open the import wizard and select "Create vectors from each column using column names." I then select columns that are in the middle of the data and click "Finish." Although the variables in MATLAB have the correct names, the values are incorrect.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
We have verified that there is a bug in MATLAB 7.0 (R14) in the way that the Import Wizard handles the vector option. To work around this issue, import the data into a single variable and then index into it in MATLAB to extract the correct value or else use DLMREAD.
One workaround that still uses the import data tool is to import the data as a variable and then index into it to get the appropriate columns. For example, choose the radio button corresponding to “Create variables matching preview” and a variable named “data” will be constructed. Then extract the appropriate columns into vector variables al follows:
col4 = data(:,4);
col5 = data(:,5);
col6 = data(:,6);
You could also use DLMREAD to specify what range of values to read. For example, to create a variable of 3 columns that contains the middle three columns of the data, use:
result = dlmread('myfile.dat','\t',[9 3 16508 5]);
Where myfile.dat is a tab delimited data file.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!