MZDDE tool box

11 visualizzazioni (ultimi 30 giorni)
Mohammed
Mohammed il 13 Ott 2011
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!

Risposta accettata

Mohammed
Mohammed il 14 Ott 2011
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!

Più risposte (1)

Walter Roberson
Walter Roberson il 13 Ott 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()

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by