To talk on Icrontic, just register!

It only takes 30 seconds.

Have an account? Sign in:

Forgot?
Hnc3
Getting settled in
Hnc3
7 Posts

Question uiimport help

Hi,
I have a problem, I am using the uigetfile and uiimport to load a dataset file. after loading the dataset file I would like the output of the dimensions ie rows and column.
with the following code I am getting the wrong dimensions……..


[input_file,pathname] = uigetfile( ...
{'*.txt', 'Text (*.txt)'; ...
'*.xls', 'Excel (*.xls)'; ...
'*.*', 'All Files (*.*)'}, ...
'Select files');

uiimport(input_file)



[pathstr, name, ext, versn] = fileparts(input_file)


r = size(name,1); % number of rows
c = size(name,2); % number of columns

disp(r) % Output
disp(c) % Output

Your help would be very much appreciated. Thank you.
shwaip
elaborate bot
shwaip
5,730 Posts
Could you be more specific with the problem? How "wrong" are the dimensions?
__________________ my photostream for ic photography challenge

Anyone who wants dropbox, please use my referral link
Hnc3
Getting settled in
Hnc3
7 Posts
Could you be more specific with the problem? How "wrong" are the dimensions?

Thank you for your reply

OK instead of receiving the dimensions of the matrix/vector I am receiving the dimension of the file name.

for example the name of the file being loaded into matlab is 'student' then the dimension output for rows r and column c is

r = 1

c = 7

which is wrong its giving the dimension of the word student and not the matrix/vector

Thank you
drasnor
124 Golden Eye Drive
drasnor
2,287 Posts
You're not actually reading data out of the file. When you open the import wizard with uiimport you need to use the wizard to create objects in your workspace corresponding to the data in the file. Right now you're just asking for information about the file itself.

-drasnor
__________________ [folding_sig2]


Hnc3
Getting settled in
Hnc3
7 Posts
You're not actually reading data out of the file. When you open the import wizard with uiimport you need to use the wizard to create objects in your workspace corresponding to the data in the file. Right now you're just asking for information about the file itself.

-drasnor

Yes I do want the information such as dimension of the content of the file.

If I use the file name 'student' Instead of using 'name' then I am getting the correct output but I want it to be dynamic where I can load different files and not limit it to one file..

r = size(student,1); % number of rows
c = size(student,2); % number of columns

The above code gives me the correct output but thats for just the student file.

Thank you
drasnor
124 Golden Eye Drive
drasnor
2,287 Posts
What I mean is that the parameter 'name' in fileparts just gives you the filename of input_file and not its contents. If you want the rest of your code to understand the objects you create from the import wizard you need to name them something generic but consistent like 'data' and use that.

-drasnor
Hnc3
Getting settled in
Hnc3
7 Posts
What I mean is that the parameter 'name' in fileparts just gives you the filename of input_file and not its contents. If you want the rest of your code to understand the objects you create from the import wizard you need to name them something generic but consistent like 'data' and use that.

-drasnor
Thank you

Im new to matlab how do I do that?
drasnor
124 Golden Eye Drive
drasnor
2,287 Posts
When you use uiimport to parse a file it will give you a list of the data object(s) it's going to create from the file. Change whatever the default name of the object you're interested in to the name you specify in your .m file. Read more here.

-drasnor
afshing63
New to the neighborhood
afshing63
1 Posts

uiimport HELP

Hi.
I have a problem,
I use Import wizard for Import such date from a txt file,this can do by using a uiimport('filename') command instead of file>Import wizard from menu.
I look for a commands that do "next" and other facilities of Import wizard(such ''comma'' & "space"as commands sentences which can use in M-file for my programming;
thanks for your attention;
shwaip
elaborate bot
shwaip
5,730 Posts
I....I don't understand.
drasnor
124 Golden Eye Drive
drasnor
2,287 Posts
The point of uiimport is to open a user interface that allows you to choose your parsing options on the fly. As such it is NOT scriptable. If you want to parse a text data file automatically as part of your program then you should really be using:

* dlmread for delimited data files.
* fscanf and friends for formatted data files.

-drasnor
Go Back   Icrontic Forums > Tech: Software > General Software > Matlab Help
Jump to
This Thread Search this Thread
Search this Thread:

Advanced Search


Current time: 9:24am (GMT)
Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Get Vanilla instead. Trust me.