Trouble reading in multiple xls files

조회 수: 2 (최근 30일)
Adrienne
Adrienne 2014년 5월 12일
댓글: BOB 2014년 5월 16일
clear all; % clears all variables from your workspace
close all; % closes all figure windows
clc; % clears command window
%%define number of trials
njump=81;
[1] input variables of trial data
%%%%%%%%%%%%%%%%%%%%%
%read in excel data in CSV format
for i=1:njump
data1=xlsread('Trial%i.csv','Trial%i','A1:E7000'); % jump data
end
^^^^^ this is what I have written, however it will not read in all of the data that I need. I have 81 trials but it will not read them in even when I have put a loop in. I am quite a novice in matlab and I don't understand what I am doing wrong. Can anyone help?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 5월 12일
편집: Azzi Abdelmalek 2014년 5월 12일
data1 is overwriten each loop, use
for i=1:njump
data1{i}=xlsread(sprintf('Trial%i.csv',i),sprintf('Trial%i',i),'A1:E7000'); % jump data
end
If you want to clear all workspace variables use
clear
% without all
  댓글 수: 10
Image Analyst
Image Analyst 2014년 5월 14일
Try using all 3 outputs of xlsread()
[numbersOnly, textOnly, everything] = xlsread(filename);
BOB
BOB 2014년 5월 16일
What shall I put this instead of?
This is the code I am trying currently:
:

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 5월 12일

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by