How do i read unsupported files rows and columns in Drop down box?

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.
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.
The File, Which does not have any extensions
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.
Every time i try to open those Files using XLSREAD comman , i get error has XLSREAD cannot open this file
Please show us a relevant part of the file and the complete error message.
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.)
Hello Friends,
Sorry for asking Vague questions, Please see the attachment for FILE PROPERTIES of file which i am trying to read,
I have tried to read these file using command
[numbers,colNames]=xlsread(file name)
But the ERROR in Command window displays :
Error using xlsread (line 129)
XLSREAD unable to open file
'TR-13-01639-102489473-14a-22b-Aug17a'.
File 'TR-13-01639-102489473-14a-22b-Aug17a' not
found.
Error in LCF_dataprocessing>setpopupmenuString
(line 98)
[numbers,colNames]=xlsread(file name);
Let me know if any more info required
Thanks!!
Hussain
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.
Hello Walter Roberson, Thanks for your Reply,
browse1= TR-13-01639-102489473-14a-22b-Aug17a;
i have used command :
d=dir('browse1')
the COMMAND WINDOWS displays :
d =
0x1 struct array with fields:
name
date
bytes
isdir
datenum
next using ls , command : ls ('browse1')
the command window:
browse1 not found.
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 '*.*'])
Hi, check the o/p: browse1 =
TR-13-01639-102489473-14a-22b-Aug17c
d=dir(browse1)
d =
name: [1x36 char]
date: '22-Aug-2013 00:19:32'
bytes: 4911241
isdir: 0
datenum: 7.3547e+05
TR-13-01639-102489473-14a-22b-Aug17c
TR-13-01639-102489473-14a-22b-Aug17c*.* not found.
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"
Actually there is no differences,, all are identical files which ever is selected those will be stored in a Variable
Happy new Year
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')
Hello,
Please fine
LCF_dataprocessing
browse1 =
TR-13-01639-102489473-14a-22b-Aug17a
d =
0x1 struct array with fields:
name
date
bytes
isdir
datenum
TR-13-01639-102489473-14a-22b-Aug17a not found.
TR-13-01639-102489473-14a-22b-Aug17a*.* not found.
107 ls (browse1)
TR-13-01639-102489473-14a-22b-Aug17a not found
Using the command : exist('TR-13-01639-102489473-14a-22b-Aug17a')
Output is : ans = 0
Sorry Typo Error when i use the command exist('browse1') The output is ans=1
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*.*
Hello Walter Roberson, command used : !ls browse1 (later tried with , *.) o/p in command window ls: cannot access browse1: No such file or directory
it seems matlab is not able to read these files
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!!
Hi
I even tried by this
system(sprintf('ls %s* %s*.*', browse1, browse1)
output :
TR-13-01639-102489473-14a-22b-Aug17a not found.
TR-13-01639-102489473-14a-22b-Aug17a*.* not found.
ls: cannot access TR-13-01639-102489473-14a-22b-Aug17a*: No such file or directory
ls: cannot access TR-13-01639-102489473-14a-22b-Aug17a*.*: No such file or directory
Okay try that again with
browse1 = 'TR-13-01639-102489473-14a-22b-Aug'

Sign in to comment.

Answers (0)

Categories

Asked:

on 23 Dec 2013

Edited:

on 29 Oct 2016

Community Treasure Hunt

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

Start Hunting!