×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Running two programs at once.

Running two programs at once.

Running two programs at once.

(OP)
I have created a Fig, now im reading into a variable 12,000,000 points from a file.  Using Textread. Now this takes me 10 min to do, I would like to have some sort of progress bar, or simply show that the computer has not frozen without lossing speed.  

I was thinking of creating an houre glass type function, or
printing out '|'->'/'->'-'->'\'->'|' to show something is going on.  

How do I run this program and read from the file at the same time.

fscanf take 6 time longer.

RE: Running two programs at once.

Eric
This doesn't run two programs at once, but it will read a text file and store it as a mat file and then read the mat file if the mat file exists and is newer than the text file.  So this code helps if you have to read the same text file over and over, but you might change it occansionaly.

function file=readfile(fname)

% Read the text file if it is new that a saved mat file

mname = [fname '.mat'];
ddmat=dir(mname);
ddout=dir(fname);

% Determine the second when the files were created

if (isempty(ddmat))
    sec_mat=0;
else
    [Y,M,D,H,MI,S] = datevec(ddmat.date); Day=datenum(ddmat.date); sec_mat=((Day*24+H)*60+MI)*60+S;
end    
[Y,M,D,H,MI,S] = datevec(ddout.date); Day=datenum(ddout.date); sec_out=((Day*24+H)*60+MI)*60+S;

% read text if out is newer than mat (or mat is zero)

if (sec_out>sec_mat | sec_mat==0)
    file = char(textread(fname,'%s','delimiter','\n','whitespace',''));
    save(mname,'file');
else
    file=load(mname,'file');
    file=file.file;
end

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources