How to get import data to count in a for loop

조회 수: 2 (최근 30일)
James
James 2014년 4월 11일
편집: Andrew Newell 2014년 4월 11일
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.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by