How to get import data to count in a for loop

2 visualizaciones (últimos 30 días)
James
James el 11 de Abr. de 2014
Editada: Andrew Newell el 11 de Abr. de 2014
Hi,
I am using a for loop that reads off a "master file" that just has a bunch off other files listed on it so I can have matlab run through multiple data sets at one time. The first loop runs through without a problem, I get my plot at the end, when it goes back through it gives me an error that is as follows,
Error using importdata (line 136)
Unable to open file.
Error in Creating_master_file (line 66)
Trial1 = importdata(filename);
I checked the file name and everything and that is not the problem. I don't know if Matlab is having trouble creating a new structure, or if i need to index it so it counts and creates a new one each time. How do I fix this error. Here is my code, if that helps at all. Thank you
clear; clc;
[num txt raw]=xlsread('vehicle master file.xlsx');
for(x=1:length(txt))
x
filename=txt{x};
Trial1 = importdata(filename);
num=Trial1.data;
txt=Trial1.textdata;
txtcolumn7=txt(32:end,7);
index1 = find(ismember(txtcolumn7,'response delay','legacy'));
num5=num(32:end,5);
DR=num(index1,5);
%remove NaN
DR1=Snip(DR,nan);
%find and remove 10's
values10=find(DR1==10);
DR1(values10)=[];
I have cut out a lot past this, but that is just a bunch of plotting commands and stuff that is not affecting this.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by