Thread Subject: gui load problem

Subject: gui load problem

From: yuval deutach

Date: 5 Feb, 2008 21:52:02

Message: 1 of 3

Hello

this is part of my program

[Max]=textread('IR95_001_testItf.txt','%*s %u %
*s','headerlines',1);
   % find the OPD from the file
 OPD=(Max(1,1) - Max(2,1))*2;
 OPDMax=Max(1,1)
 OPDMin=Max(2,1)
 %calculat Interferogram
  vector1=textread('IR95_001_testItf.txt','%
d','headerlines',3);
 b=mean(vector1');


I would like to be able to load any file and not just as i
worte as fix file('IR95_001_testItf.txt')
in my file i need first to read line number 1,2
and then to read into vector line number 3

Thank's for the help
Yuval




Subject: gui load problem

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 5 Feb, 2008 22:05:26

Message: 2 of 3

In article <foalq1$4a5$1@fred.mathworks.com>,
yuval deutach <yuval.nospam@mathworks.com> wrote:

>this is part of my program

>[Max]=textread('IR95_001_testItf.txt','%*s %u %
>*s','headerlines',1);
> % find the OPD from the file
> OPD=(Max(1,1) - Max(2,1))*2;
> OPDMax=Max(1,1)
> OPDMin=Max(2,1)
> %calculat Interferogram
> vector1=textread('IR95_001_testItf.txt','%
>d','headerlines',3);
> b=mean(vector1');

>I would like to be able to load any file and not just as i
>worte as fix file('IR95_001_testItf.txt')
>in my file i need first to read line number 1,2
>and then to read into vector line number 3

fname = uigetfile('*.txt');
fid = fopen(fname, 'rt');
if fid < 0
  error(sprintf('File %s was not readable', fname));
end
Max = textscan(fid, '%*s %u %s, 2, 'headerlines', 1); %read 2 items
OPDMax=Max(1,1)
OPDMin=Max(2,1)
OPD=(OPDMax - OPDMin)*2;
%calculat Interferogram
vector1=textscan(fid, '%d'); %continue read, skip nothing
fclose(fid);
b=mean(vector1');

--
   "Okay, buzzwords only. Two syllables, tops." -- Laurie Anderson

Subject: gui load problem

From: yuval deutach

Date: 6 Feb, 2008 21:40:20

Message: 3 of 3

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <foamj6$fmh$1@canopus.cc.umanitoba.ca>...
> In article <foalq1$4a5$1@fred.mathworks.com>,
> yuval deutach <yuval.nospam@mathworks.com> wrote:
>
> >this is part of my program
>
> >[Max]=textread('IR95_001_testItf.txt','%*s %u %
> >*s','headerlines',1);
> > % find the OPD from the file
> > OPD=(Max(1,1) - Max(2,1))*2;
> > OPDMax=Max(1,1)
> > OPDMin=Max(2,1)
> > %calculat Interferogram
> > vector1=textread('IR95_001_testItf.txt','%
> >d','headerlines',3);
> > b=mean(vector1');
>
> >I would like to be able to load any file and not just
as i
> >worte as fix file('IR95_001_testItf.txt')
> >in my file i need first to read line number 1,2
> >and then to read into vector line number 3
>
> fname = uigetfile('*.txt');
> fid = fopen(fname, 'rt');
> if fid < 0
> error(sprintf('File %s was not readable', fname));
> end
> Max = textscan(fid, '%*s %u %s, 2, 'headerlines', 1); %
read 2 items
> OPDMax=Max(1,1)
> OPDMin=Max(2,1)
> OPD=(OPDMax - OPDMin)*2;
> %calculat Interferogram
> vector1=textscan(fid, '%d'); %continue read, skip
nothing
> fclose(fid);
> b=mean(vector1');
>
> --
> "Okay, buzzwords only. Two syllables, tops." --
Laurie Anderson

Thanks Laurie

but it is not working i try it befor and now.
i add the format of my files, mybe it will help you to
help me
% this is the file format:

InterfLength, 256
MaxInterferPos, 15886.50
MinInterferPos, 1363.17
2910 3015 3175 3227 3076

i need to read the max number, the min number and the last
line to different variables

thanks
Yuval

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
still have problem yuval deutach 6 Feb, 2008 16:40:31
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com