How do i read unsupported files rows and columns in Drop down box?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
dpb
2013-12-23
编辑:dpb
2013-12-23
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.
dpb
2013-12-23
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.
dpb
2013-12-24
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
2013-12-28
Every time i try to open those Files using XLSREAD comman , i get error has XLSREAD cannot open this file
Image Analyst
2013-12-28
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.
dpb
2013-12-28
编辑:dpb
2013-12-29
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
2013-12-31
编辑:Walter Roberson
2016-10-29
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
Walter Roberson
2013-12-31
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
2013-12-31
编辑:Walter Roberson
2013-12-31
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.
Walter Roberson
2013-12-31
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
2013-12-31
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.
Walter Roberson
2013-12-31
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
2014-1-2
Actually there is no differences,, all are identical files which ever is selected those will be stored in a Variable
Happy new Year
Walter Roberson
2014-1-2
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
2014-1-2
编辑:Walter Roberson
2016-10-29
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
Walter Roberson
2014-1-2
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
2014-1-2
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
Walter Roberson
2014-1-2
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
2014-1-2
编辑:Walter Roberson
2014-1-2
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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)