From: Justme on 28 Jun 2010 23:23 dpb <none(a)non.net> wrote in message <i0b10d$tdv$1(a)news.eternal-september.org>... > Justme wrote: > ... > > > [time2 data2] = textread(SIM_filename, ... > >'*s%f%*s%*s%f%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s'); > ... > > BTW, a syntax idiom you might find useful... > > fmt = ['*s%f%*s%*s%f repmat('%*s',1,18)]; > [time2 data2] = textread(SIM_filename, fmt); > > -- Thank you dpb. I'm sorry I'm being vague with my script. This is basically what i've put together (minus the plotting section)..I actually just put up another post asking for help in determing the interp1 function because I am starting to lose confidence in my script..i've been staring at this thing too long SIM_Slow_filename = 'C:\Program Files\MATLAB\R2009b\Data1.txt'; FLT_Fast_filename = 'C:\Program Files\MATLAB\R2009b\Data2.txt'; [time1 variable1] = textread(FLT_Fast_filename,'%f%*s%*s%*s%*s%*s%*s%*s%*s%f'); [time2 variable2] = textread(SIM_Slow_filename,'%*s%f%*s%*s%*s%f'); %Asks for user input and indicies to compute time user_entry_START_FLT_Fast = input('Please input starting Flight Time (in seconds):'); user_entry_STOP_FLT_Fast = input('Please input stop Flight Time (in seconds):'); ind = find(time1 >= user_entry_START_FLT_Fast & time1 <= user_entry_STOP_FLT_Fast); user_entry_START_SIM_Slow = input('Please input starting Sim Time (in seconds):'); user_entry_STOP_SIM_Slow = input('Please input stop Sim Time (in seconds):'); ind2 = find(time2 >= user_entry_START_SIM_Slow & time2 <= user_entry_STOP_SIM_Slow); % finds nth time and resets values to zero time1 = time1(ind); %flight_seconds variable1 = variable1(ind); %flight_data (does not change) time2 = time2(ind2); %interpolated_seconds variable2 = variable2(ind2); %data time1 = time1-time1(1); time2 = time2-time2(1); indsDup = find(diff(time2)~=0); time2 = time2(indsDup); variable2 = variable2(indsDup); %interpolated data flight_interp=interp1(time1, variable1, time2); %performance performance_data = abs(variable2-flight_interp); This will help me with manual inputs...it's getting it automative that i'm going after..I will try to see if I can take your previous post and apply it to this. If this helps shed some light at all please let me know.
From: Justme on 30 Jun 2010 12:24 dpb <none(a)non.net> wrote in message <i0b10d$tdv$1(a)news.eternal-september.org>... > Justme wrote: > ... > > > [time2 data2] = textread(SIM_filename, ... > >'*s%f%*s%*s%f%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s'); > ... > > BTW, a syntax idiom you might find useful... > > fmt = ['*s%f%*s%*s%f repmat('%*s',1,18)]; > [time2 data2] = textread(SIM_filename, fmt); > > -- Alright, After some days of tinkering, I was able to make my script automative. Not only that, but I was able to output the plots into a folder (thank God). Now, I need some help on some cosmetics..I hope you all can help, and I hope that I can explain this as properly as possible. This is what I came up with...(and yes I did take out certain parts) Dummytext_filename = 'C:\Documents and Settings\Me\InterpTestRead.txt'; FLT_filename = 'C:\Program Files\Me\Airial.txt'; SIM_filename = 'C:\Program Files\Me\simrun.txt'; outputPath = 'C:\Documents and Settings\Me\Myfirstfolder\'; [fltname startflt stopflt startsim stopsim] = textread(Dummytext_filename,'%*s%f%f%f%f%f'); [time1 data1] = textread(FLT_filename,'%f%f'); [time2 data2] = textread(SIM_filename,'%*s%f%*s%*s%f%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s%*s'); for k = 1:length(startflt) START_FLT = startflt(k); STOP_FLT = stopflt(k); START_SIM = startsim(k); STOP_SIM = stopsim(k); figure1 = strcat(outputPath,num2str(floor(startflt(k))),'Dataflt'); figure2 = strcat(outputPath,num2str(floor(startflt(k))),'Performance'); %Plotting %Performance Plot figure(k+length(startflt)) x = (1:length(performance_data)); ang = linspace(0,3); plot(ang) %Criteria Criterion = 3; TF = find(performance_data > Criterion); % a logical vector NumberpointsAboveCriterion = length(TF); TotalNumberOfPoints = numel(performance_data); PointsAbove = performance_data(TF); PercentageAbove = NumberpointsAboveCriterion/TotalNumberOfPoints*100; plot(x,performance_data,'r*') hold on plot(x,Max*ones(length(x),1),'w') plot(x,Min*ones(length(x),1),'w') plot(x,Avg*ones(length(x),1),'w') plot(x,Criterion*ones(length(x),1),'b') grid on hold off hold on xlabel('Seconds'); ylabel('A diff (Kts)'); legend('A Diff',strcat('Max =',num2str(Max)),strcat('Min =',num2str(Min)),strcat('Avg =',num2str(Avg)),strcat('% > CRIT =',num2str(PercentageAbove)),'Location','SouthOutside','Orientation','horizontal'); % title('Run 1 Maneuver 5.1'); hold off print(gcf,'-djpeg',figure2); %flight interp plots figure(k) plot(time1b,data1b,'b.') hold on grid on plot(time2b,data2b,'r.') plot(time2b,flight_interp,'g.') hold off hold on xlabel('Seconds'); ylabel('Airspeed (kts)'); legend('Flight Test','Sim Air','Flight Inter Air','Location','SouthOutside','Orientation','horizontal'); % title('Run 1 Maneuver 5.1'); hold off print(gcf,'-djpeg',figure1); end For each data I process, there are two plots produced. One based on performance and one based on data. When I produce my plots, I am able to hard code the x and y axis titles because those never change...what does change however, is my title. I would like to have it so that all my plots have the proper corresponding titles. The "problem" is however, they are not sequential..they don't go from 1-10..they may do something like this.. "Data 1 Diagram 1.5.1"..."Performance 1 Diagram 1.5.1","Data 1 Diagram 1.5.3".."Performance 1 Diagrama 1.5.3",etc. How would I go about scripting this in matlab? Also, when I output my files..is there a way that I can change the title of the file name output that also corresponds to my graphs? The way I have it now when I output a plot (jpeg format) into a folder, it will get stored as the last number of the data being read..followed by the word I assigned it to (hardcoded)...e.g 22587Data.jpeg...but I would like it to say...Data1.5.1.jpg..Performance1.5.1.jpg,Data1.5.3.jpg..Performance1.5.3..jpg..etc. Hope I explained that correctly. Thanks guys..
From: dpb on 30 Jun 2010 13:08 Justme wrote: .... > to hard code the x and y axis titles because those never change...what > does change however, is my title. I would like to have it so that all > my plots have the proper corresponding titles. The "problem" is however, > they are not sequential..they don't go from 1-10..they may do something > like this.. "Data 1 Diagram 1.5.1"..."Performance 1 Diagram 1.5.1","Data > 1 Diagram 1.5.3".."Performance 1 Diagrama 1.5.3",etc. How would I go > about scripting this in matlab? Somehow you have to be able to know what title belongs on which plot. Wherever that data resides, you can use combination of and/or num2str, sprintf and friends to create the title string. I'd recommend doing it as a character variable rather than inside the text() call simply for ease in debugging and you could even want to do it in some number of substeps, but the principle is trivial. > Also, when I output my files..is there a way that I can change the title > of the file name output that also corresponds to my graphs? ... Same thing; build the filename desired as a variable and use it. We discussed this at some length some time ago either upthread in this thread or in one of the (many) others on the same subject. --
From: dpb on 30 Jun 2010 13:15 dpb wrote: > Justme wrote: > ... .... >> Also, when I output my files..is there a way that I can change the >> title of the file name output that also corresponds to my graphs? ... > > Same thing; build the filename desired as a variable and use it. .... OBTW, I'd recommend avoiding the multiple dots in the file names you do build in lieu of dashes, underscores or similar separators. --
From: Justme on 30 Jun 2010 13:23 dpb <none(a)non.net> wrote in message <i0ftr6$4jl$1(a)news.eternal-september.org>... > Justme wrote: > ... > > > to hard code the x and y axis titles because those never change...what > > does change however, is my title. I would like to have it so that all > > my plots have the proper corresponding titles. The "problem" is however, > > they are not sequential..they don't go from 1-10..they may do something > > like this.. "Data 1 Diagram 1.5.1"..."Performance 1 Diagram 1.5.1","Data > > 1 Diagram 1.5.3".."Performance 1 Diagrama 1.5.3",etc. How would I go > > about scripting this in matlab? > > Somehow you have to be able to know what title belongs on which plot. > Wherever that data resides, you can use combination of and/or num2str, > sprintf and friends to create the title string. I'd recommend doing it > as a character variable rather than inside the text() call simply for > ease in debugging and you could even want to do it in some number of > substeps, but the principle is trivial. > > > Also, when I output my files..is there a way that I can change the title > > of the file name output that also corresponds to my graphs? ... > > Same thing; build the filename desired as a variable and use it. > > We discussed this at some length some time ago either upthread in this > thread or in one of the (many) others on the same subject. > Thanks. Fixed. I appreciate the help.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Axis and Textread Question Next: Covariance Matrix with NaNs |