How to sort and plot these 3 sets of Data from a single text file into 3 different curve and also do the average of those plot in different plot?

1 vue (au cours des 30 derniers jours)
Sanaul Haque le 18 Sep 2019
Commenté : Sanaul Haque le 4 Oct 2019
Hi I am using this bottom code to read the file and sort them and plot in a single plot. But Now I want to plot this 3 sets of data in every text file different plot in the same graph and at the same the average of those 3 graphs in another plot. I am kind of stuck what to do here?
clear all
close all
clc
f = dir('*.txt');
for ii = 1:numel(f)
thisfilename = f(ii).name;
thisdata = fopen(thisfilename);
fclose(thisdata);
d{ii} = cell2mat(dc{ii});
Wave1 = d{ii}(:,2);
Intensity1 = d{ii}(:,3);
[Wave , I] = sort(Wave1);
Intensity = Intensity1(I);
figure(ii);
plot(Wave,Intensity);
title(thisfilename);
ix=strfind(thisfilename,'-');
t=thisfilename(ix(1)+1:ix(2)-1);
legend(t);
xlabel('Wavenumber');
ylabel('Intensity');
end
0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

Réponses (1)

Abhilash Padma le 4 Oct 2019
Sub plots can be used to plot different sets of data separately on the same figure. You can refer the following link for documentation: https://in.mathworks.com/help/matlab/ref/subplot.html
1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Sanaul Haque le 4 Oct 2019
Sorry my main concern was how to read and plot that 3 sets of data separately from any given text file considering all have the 3 sets of data not necessarily same wavenumber though.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Annotations dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by