How do i read unsupported files rows and columns in Drop down box?
Show older comments
Hi Team,
I have few set of unsupported files but can be readable/writable from excel ,
what command do i need to use for Reading these unsupported file's Columns/Rows and display its Headers in My GUI Drop-downs Box ???
25 Comments
help iofun
and choose from the list what seems to fit the file format the best...there's always fscanf at the basic i/o level.
W/O knowing anything at all about the file structure itself, that's about the best can do...answers can be only as good as the question input supplied.
Image Analyst
on 23 Dec 2013
What does "unsupported" mean?
dpb
on 23 Dec 2013
OP will have to answer for certain, but I'd presume he means something for which there's not an existing Matlab routine to handle, specifically...altho if Excel reads it, one would think it's likely actually a delimited file of some type.
hussain
on 24 Dec 2013
dpb
on 24 Dec 2013
The extension itself has no bearing on anything other than the name; it is simply a convenient identifier for what the content is but that's all it is.
Again, nobody can help w/o specific information on the form of the file...altho as noted above, if Excel reads it the likelihood is that it's simply a delimted file of some sort, the delimiter and content unknown given that you've not posted any snippet to be able to see...
Answers again can only respond to the information provided which is, so far, essentially none.
hussain
on 28 Dec 2013
Jan
on 28 Dec 2013
Please show us a relevant part of the file and the complete error message.
Image Analyst
on 28 Dec 2013
Maybe you only think it has no extension because you're using the dumb default choice Windows makes (in an effort to be more like Macs) to hide the extension for known file types. I really really hate that. You can go into Folder Options to uncheck that option and have it show extensions.
You've yet to show anything of any useful help to diagnose a problem...
a) XLSREAD expects an Excel .xls or other specific Excel file format. It won't care about an extension if it doesn't actually have one altho not having one will obviously break the link to the Windoes automagic file association.
b) Excel, otoh, will open a delimited text file and import it if it can transparently so it's not surprising the same file may be "readable" by Excel.
First use the alternate return from fopen on the file and report what the error message is if the return value fid is -1 --
[fid,msg]=fopen('whateverthefilenameyouthinkis')
That will identify if it's a naming issue or not in the path or the like as it will be a "Not found" type as opposed to anything related to the content.
Then, to check on the extension, use
d=dir('thefilename.*');
d(:).name
and see what is returned. NB: of course, that need the actual file name you think the file has in the above calls. The wild card in the dir argument will return any file of the base name rather than just those w/o an actual extension so you'll see whether there is something there as IA has hypothesized.
After all that, as have requested and at least one other poster asked, paste a few lines of the content of the file (using the {}Code formatter to make it look correct in the Preview window; otherwise the stupid Answers entry form will wordwrap it and it'll be gibberish as far as determining the actual record format.)
hussain
on 31 Dec 2013
Edited: Walter Roberson
on 29 Oct 2016
Walter Roberson
on 31 Dec 2013
Please show us the output of
dir TR-13-01639-102489473-14a-22b-Aug17a
dir TR-13-01639-102489473-14a-22b-Aug17a*.*
ls TR-13-01639-102489473-14a-22b-Aug17a*.*
At the moment, xlsread cannot find the files. The files do not exist under that name in that directory. There might be a hidden extension; if so then the ls should show it. Or you might be in the wrong directory.
hussain
on 31 Dec 2013
Edited: Walter Roberson
on 31 Dec 2013
Walter Roberson
on 31 Dec 2013
When you put the file names into variables, do not quote them in the calls.
browse1 = 'TR-13-01639-102489473-14a-22b-Aug17a';
d = dir(browse1)
ls(browse1)
ls([browse1 '*.*'])
hussain
on 31 Dec 2013
Walter Roberson
on 31 Dec 2013
The file that you were unable to open before was
TR-13-01639-102489473-14a-22b-Aug17a
and the file that you are finding now is
TR-13-01639-102489473-14a-22b-Aug17c
Notice the difference in ending, "a" compared to "c"
hussain
on 2 Jan 2014
Walter Roberson
on 2 Jan 2014
We need consistency in order to be able to debug properly. Try again with the "a" version.
Also show us the output of
exist('TR-13-01639-102489473-14a-22b-Aug17a')
hussain
on 2 Jan 2014
Edited: Walter Roberson
on 29 Oct 2016
hussain
on 2 Jan 2014
Walter Roberson
on 2 Jan 2014
If browse1 is a variable, do not quote it when you pass it to a command.
exist(browse1)
The result 0 from exist('TR-13-01639-102489473-14a-22b-Aug17a') tells us that the file is not found. Which is also what the 0x1 struct array result from dir() tells us.
So now please show us
!ls TR-13-01639-102489473-14a-22b-Aug17* TR-13-01639-102489473-14a-22b-Aug17*.*
hussain
on 2 Jan 2014
Walter Roberson
on 2 Jan 2014
Did I say to put in browse1 at that point? Or did I give a complete file name?
If you insist on using browse1 then
system(sprintf('ls %s* %s*.*', browse1, browse1)
do not quote browse1 there!!
hussain
on 2 Jan 2014
Edited: Walter Roberson
on 2 Jan 2014
Walter Roberson
on 2 Jan 2014
Okay try that again with
browse1 = 'TR-13-01639-102489473-14a-22b-Aug'
hussain
on 2 Jan 2014
Answers (0)
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!