Matlab to IDL [message #36627] |
Sat, 11 October 2003 09:50  |
dino.nicola
Messages: 7 Registered: October 2003
|
Junior Member |
|
|
hi! i'm trying to translate this Matlab script into IDL, but the image
I show is not right.
function [RAD]=read_1rad(i_pr,Directory,prefix)
i_pr
Directory
CONC=[Directory prefix]
nome=[ CONC num2str(i_pr) '.sdt']
FID=0;
FID=fopen(nome,'r','ieee-be');
[RAD,c]=fread(FID,[1024,512],'float32');
figure(3), imshow(RAD,[ ]); title(' proiezione ')
fclose(FID);
colormap(gray(512));
Here is the IDL script:
file='c:\pcon_1.sdt'
rad=fltarr(1024,512)
openr,lun,file,/get_lun
point_lun,lun,0
readu,lun,rad
close,lun
device,decomposed=0
loadct,0
tv,rad
end
Anybody can help me? thanks!
|
|
|
Re: Matlab to IDL [message #36712 is a reply to message #36627] |
Mon, 13 October 2003 10:01   |
dino.nicola
Messages: 7 Registered: October 2003
|
Junior Member |
|
|
Finally I could solve the problem! Here is the code working good:
file='c:\pcon_1.sdt'
rad=fltarr(1024,512)
openr,lun,file,/get_lun,/swap_endian
point_lun,lun,0
readu,lun,rad
close,lun
window,xs=1024,ys=512
device,decomposed=0
loadct,0
tvscl,rad
end
So the big question was the /SWAP_ENDIAN ( either
/SWAP_LITTLE_ENDIAN) keyword. I'm running IDL on a PC with Windows
2000 but I don't know what kind of system the data are coming from.
Thanks a lot, I really appreciate your help! Dino
|
|
|
Re: Matlab to IDL [message #36717 is a reply to message #36627] |
Mon, 13 October 2003 03:04   |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
dino nicola wrote:
> hi! i'm trying to translate this Matlab script into IDL, but the image
> I show is not right.
>
> function [RAD]=read_1rad(i_pr,Directory,prefix)
> i_pr
> Directory
> CONC=[Directory prefix]
> nome=[ CONC num2str(i_pr) '.sdt']
> FID=0;
> FID=fopen(nome,'r','ieee-be');
The ieee-be option indicates your data is big endian.
> [RAD,c]=fread(FID,[1024,512],'float32');
> figure(3), imshow(RAD,[ ]); title(' proiezione ')
> fclose(FID);
> colormap(gray(512));
>
>
> Here is the IDL script:
>
> file='c:\pcon_1.sdt'
> rad=fltarr(1024,512)
> openr,lun,file,/get_lun
to read big endian data in IDL on a little endian system you need to append
the /SWAP_ENDIAN keyword to openr.
What hardware are you running IDL on?
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
|
|
|
|
|
|
|
Re: Matlab to IDL [message #49380 is a reply to message #36627] |
Mon, 17 July 2006 08:05  |
Bruce Bowler
Messages: 128 Registered: September 1998
|
Senior Member |
|
|
On Sun, 16 Jul 2006 07:00:25 -0400, Ken Mankoff put fingers to keyboard
and said:
> A great way to help learn them is to use an interactive (realtime) regex
> demonstrator... A non-free one is the Regex Coach
> http://weitz.de/regex-coach/ but I know some free ones exist, just not
> where right now... If anyone has a web-based free version I'd love to know
> about it.
According to the website, it's free for private or non-commercial use.
ISTM that "teaching yourself the ins and outs of regex's" is both private
and non-commercial.
--
+-------------------+--------------------------------------- ------------+
Bruce Bowler | One learns in life to keep silent and draw one's
1.207.633.9600 | own confusions. - Cornelia Otis Skinner
bbowler@bigelow.org |
+-------------------+--------------------------------------- ------------+
|
|
|
Re: Matlab to IDL [message #49385 is a reply to message #49270] |
Sun, 16 July 2006 04:00  |
Ken Mankoff
Messages: 158 Registered: February 2000
|
Senior Member |
|
|
On Mon, 10 Jul 2006, Paul Van Delst wrote:
> Tell me about it. I couldn't put it off any longer so I'm teaching
> myself how to use regular expressions via Jeff Friedl's "Mastering
> Regular Expressions". Cripes. Being an old vi user, I knew the
> stone cold basics, but now that regex's like
> /\b([a-z]+)((?:\s|<[^>]+>)+)(\1\b)/
> start to make sense to me I'm beginning to get worried.... :o)
A great way to help learn them is to use an interactive (realtime)
regex demonstrator... A non-free one is the Regex Coach
http://weitz.de/regex-coach/ but I know some free ones exist, just
not where right now... If anyone has a web-based free version I'd
love to know about it.
-k.
|
|
|