views:

56

answers:

2

I tried using uiimport to load a file to the base workspace.....It worked first time....but after trying again after a while...I wasnt seeing the variable in the base work space. I used the default variable name which is given by 'uiimport".

This was the command I used:

uiimport(filename)

And two variables where created by default..."data" and "textdata"(which is the header)....but now when i run it is no longer saved in the base workspace

I do not want to assign a variable to the uiimport like so...

K = uiimport(filename)
assignin(base,'green',K)

I do not want to do that because My dataset has a text header and the data itself, and doing this would assign both "textdata" and "data" to "green" variable

How would I be able to get the dimensions of ONLY the "data" in green and how would I pass only "data"(which is in the green variable in the workspace.."rmbr"...the green variable holds both "data" and "textdata") to another function.

I was able to do all this when the uiimport automatically saved the variables in the base workspace....but somehow now it doesn't.

I would appreciate any help or tips on this matter

A: 

Use

K = uiimport(filename);
green=[K.data];

to get only numerical data in your green variable.

uiimport returns file data as a structure containing the fields data, textdata, and colheaders. To return only the data field, assign another variable as K.data, or simply reassign K=K.data if you don't want the rest of the information contained by the file.

Doresoom
A: 

One thing to note about UIIMPORT is that it will save variables to the workspace from which it is called. If you call it from the command window, the variables will be saved to the base workspace. However, if you call it from within a function, the variables will be saved in the workspace of the function. This may explain why you are not seeing the variables appear in the base workspace.

One solution would be to do the following, using the function ASSIGNIN:

K = uiimport(filename);           %# Load your data into a structure K
assignin('base','green',K.data);  %# Get the "data" field from K and assign
                                  %#   it to variable "green" in the base
                                  %#   workspace
gnovice