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 Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2011년 10월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by