From: Justme on
Good Morning Community,
Again, thanks for all of your help as I am starting to feel alot more comfortable with this new area of matlab script writing. I have come with a new question.

Currently, I have written a script which asks the user for specific time inputs, which are of course limited by where I have the files being read from (textread) and spits out two different plots based on performance and time (where the second plot based on time, should be based on the first). I have also come to the realization however, that this is becoming more tedious as I get more workload and would like to do two things. 1. Make it fully automated so that my script can automatically read the times already specified from the files without manually being told to. 2. When it produces the two plots, I would like the axis of the SECOND plot produced to represent the same axis of the first. In other words, my first plot has a certain scale of x and y, I would like my second to have the same scaling without me having to manually go in and change them. Makes sense? This is what I
currently have (these are just snippets of the code)

Also, Is there anyway to make my "titles" of my plots automated as well? So as my plots or being produced, they change based on the different data it reads?

Thank again.

Trying to make this fully automated.

1. [time1 data1] = textread(Slow_filename,'%f%*s%*s%*s%*s%*s%*s%*s%*s%f');
[time2 data2] = textread(Fast_filename,'%*s%f%*s%*s%*s%f');

user_entry_START = input('Please input starting Time (in seconds):');
user_entry_STOP = input('Please input stop Time (in seconds):');
ind = find(time1 >= user_entry_START & time1 <= user_entry_STOP);


user_entry_Data1 = input('Please input starting D_First_Time (in seconds):');
user_entry_Data2 = input('Please input stop D_Second_Time (in seconds):');
ind2 = find(time2 >= user_entry_D_First_Time & time2 <= user_entry_STOP_D_Second Time);



Axis question

2. figure(2)

plot(x,performance_data,'r*')

hold on
axis(n values for x and y)
plot(x and y)
xlabel
ylabel
title('This I would like to change as it produces plots');
grid on
hold off

figure(1)

axis('Would like this axis to be a reflection of the first plot')
hold on
xlabel('Seconds');
ylabel('Some Y label (deg)');
legend('Some words here');
title('This I would like to change as it produces plots');
hold off
From: dpb on
Justme wrote:
> Good Morning Community,
> Again, thanks for all of your help as I am starting to feel alot more
> comfortable with this new area of matlab script writing. I have come
> with a new question.


Hey, chill dood...three posts in a couple minutes???


> Currently, I have written a script which asks the user for specific time
> inputs, which are of course limited by where I have the files being read
> from (textread) and spits out two different plots based on performance
> and time (where the second plot based on time, should be based on the
> first). I have also come to the realization however, that this is
> becoming more tedious as I get more workload and would like to do two
> things. 1. Make it fully automated so that my script can automatically
> read the times already specified from the files without manually being
> told to. 2. When it produces the two plots, I would like the axis of
> the SECOND plot produced to represent the same axis of the first. In
> other words, my first plot has a certain scale of x and y, I would like
> my second to have the same scaling without me having to manually go in
> and change them. Makes sense? This is what I currently have (these
> are just snippets of the code)
> Also, Is there anyway to make my "titles" of my plots automated as well?
> So as my plots or being produced, they change based on the different
> data it reads?
>
> Thank again.
>
> Trying to make this fully automated.
>
> 1.

[time1 data1] = textread(Slow_filename,'%f%*s%*s%*s%*s%*s%*s%*s%*s%f');
[time2 data2] = textread(Fast_filename,'%*s%f%*s%*s%*s%f');
>
> user_entry_START = input('Please input starting Time (in seconds):');
> user_entry_STOP = input('Please input stop Time (in seconds):');
> ind = find(time1 >= user_entry_START & time1 <= user_entry_STOP);
>
>
> user_entry_Data1 = input('Please input starting D_First_Time (in seconds):');
> user_entry_Data2 = input('Please input stop D_Second_Time (in seconds):');
> ind2 = find(time2 >= user_entry_D_First_Time & time2 <= user_entry_STOP_D_Second Time);

Well, you gave no clues as to what the data is from the file or filename
to use for the time.

Assuming it's in there somewhere undoubtedly it would be possible to
decode it for whatever purpose...

> Axis question
>
> 2. figure(2)
> plot(x,performance_data,'r*')
> hold on
> axis(n values for x and y)
> plot(x and y)
> xlabel
> ylabel
> title('This I would like to change as it produces plots');

Again, as long as you have some piece of information in the data files
from which to generate the text for the plot title, sure. Simply use
whatever logic you need and perhaps num2str() and/or sprintf() to build
the appropriate title and pass that to title()

> grid on
> hold off
> figure(1)
>
> axis('Would like this axis to be a reflection of the first plot')
> hold on

Just remove the second axis() statement; one of the results of

hold on

is to retain axis limits for subsequent plots.

doc hold

> xlabel('Seconds');
> ylabel('Some Y label (deg)');
> legend('Some words here');
> title('This I would like to change as it produces plots');

see above

> hold off

above probably doesn't hurt but doesn't do anything at this point, either...

--
From: Justme on
dpb <none(a)non.net> wrote in message <i0a9s4$pcu$1(a)news.eternal-september.org>...
> Justme wrote:
> > Good Morning Community,
> > Again, thanks for all of your help as I am starting to feel alot more
> > comfortable with this new area of matlab script writing. I have come
> > with a new question.
>
>
> Hey, chill dood...three posts in a couple minutes???

Didn't realize I posted three until now. My apologies. That's what I get for refreshing huh?

Figured out I was using some wrong function calls in the first place which is why I was getting "wrong" axis reading in my second plot. So I suppose the first question still applies regarding automating my code.

Perhaps this will better explain:

Readme_filename = 'dummyfile.txt'; %replace for DIS
Readmetoo_filename = 'dummyfilefriend.txt';

[time1 data1] = textread(FLT_Slow_filename,'%f%*s%*s%*s%*s%*s%*s%*s%*s%f');
[time2 data2] = textread(SIM_Fast_filename,'%*s%f%*s%*s%*s%f');

%%Call variable altbias (a variable that has the altitude bias)

%Asks for user input and indicies to compute time

user_entry_START_FLT_Slow = input('Please input starting Flight Time (in seconds):');
user_entry_STOP_FLT_Slow = input('Please input stop Flight Time (in seconds):');
ind = find(time1 >= user_entry_START_FLT_Slow & time1 <= user_entry_STOP_FLT_Slow);


user_entry_START_SIM_Fast = input('Please input starting Sim Time (in seconds):');
user_entry_STOP_SIM_Fast = input('Please input stop Sim Time (in seconds):');
ind2 = find(time2 >= user_entry_START_SIM_Fast & time2 <= user_entry_STOP_SIM_Fast);

That in it's entirety starts my script. Matlab asks user for user defined inputs and spits out two plots. I was thinking that I could remove the text based inputs and just try to do a textread of the already predetermined times from a new textread file. That still raises some questions though...how I can change the title in my script section for plots, directly correlating with the predetermined flight times (if possible).

Thanks again for the help. Sorry for the triple post.
From: sscnekro on
> Also, Is there anyway to make my "titles" of my plots automated as well? So as my plots or being produced, they change based on the different data it reads?

Sorry, I am not able at the moment to reply to all your questions, but for this one: If you could store all the strings you will use as plot titles for e.g. in a cell aray mytitle, you could refer to mytitle{ii} in your loop. Analogy wrt structures. Is this what you mean by automated titles?
From: Justme on
"sscnekro " <in(a)mail.net> wrote in message <i0ahd9$lfq$1(a)fred.mathworks.com>...
> > Also, Is there anyway to make my "titles" of my plots automated as well? So as my plots or being produced, they change based on the different data it reads?
>
> Sorry, I am not able at the moment to reply to all your questions, but for this one: If you could store all the strings you will use as plot titles for e.g. in a cell aray mytitle, you could refer to mytitle{ii} in your loop. Analogy wrt structures. Is this what you mean by automated titles?

Thank you sscnekro. That is one possible solution. I apologize for the triple post as well. I also thought (which i'm going to put in my first post) that I could produce another text read that would just link to a cell array and output onto the plots based on what is being read in my newest dummy file. I will post my ongoing procedure in the main post for clarity and to help consolidate this post since I posted way to many times.

Thanks again.