Ok. The problem was zemax creates a unicode text file which cannot be accessed by the above functions. So, I converted it to ASCII format using unicode2ascii() function.Then using readColData() to extract the target content.Works Fine!
MZDDE tool box
10 views (last 30 days)
Show older comments
Hallo, I tried to get the PSF cross section data in the form of a text by zemax-matlab integration using zGettextfile function. But the problem is that I cannot read the text file which is obtained from this function. I used readcoldata function which gives the following error
"Assignment has more non-singleton rhs dimensions than non-singleton
subscripts
Error in readColData (line 95)
labels(n,1:length(next)) = next; % append to the labels matrix
Error in test2 (line 4)
[labels,x,y]=readColData('C:\Users\etesam\Documents\MATLAB\jjj.txt',3,15); % reads the data
ignoring the headers."
Then, I tried with dlmread function which gives this error
"Index exceeds matrix dimensions.
Error in dlmread (line 146)
result = result{1};
Error in test2 (line 6)
M = dlmread('C:\Users\etesam\Documents\MATLAB\jjj.txt','\t',16,1);
Please suggest!
Thank you.
P.S: As soon as I copy it and make a new text file it works!
0 Comments
Accepted Answer
More Answers (1)
Walter Roberson
on 13 Oct 2011
dlmread() can only be used on numeric files -- it cannot even handle text headers. dlmread() requires that every line have the same number of columns.
I am not familiar with readColData()
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!