MATLAB Answers

How to load several and multiple files and plot them?

30 views (last 30 days)
Jonathan Bijman
Jonathan Bijman on 25 May 2019
Commented: Jonathan Bijman on 31 May 2019
Dear community
I´m working with multiple data and I´d want to plot:
One specific column from every files v/s time.
Every file is according with one day specific.
How can I plot them by using a loop?
Thanks in advance!


Show 1 older comment
Jonathan Bijman
Jonathan Bijman on 25 May 2019
I did this:
clear all
% Specify the folder where the files live.
myFolder = 'C:\Users\jonat\Desktop\Clean';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isdir(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder);
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.jpg'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
num= xlsread ('C:\Users\jonat\Desktop\Clean');
Voc = num (:,5);
fecha = num (:,1);
plot (Voc,fecha)
But I don´t get the plot of that. What can I do?
per isakson
per isakson on 25 May 2019
  • xlsread() doesn't read jpg-files
  • file name missing in xlsread ('C:\Users\jonat\Desktop\Clean')

Sign in to comment.

Answers (0)