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!

 採用された回答

Mohammed
Mohammed 2011 年 10 月 14 日

0 投票

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!

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 10 月 13 日

0 投票

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()

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

質問済み:

2011 年 10 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by