Hi,
I am trying to implement code where the user is asked to choose the range of data they want to import from excel. Here is what I have so far:
clc, clear, close all
[baseFileName, folder]=uigetfile('*.xl*','Specify an Excel file');
fullFileName=fullfile(folder,baseFileName);
[totalRange]=xlsread(fullFileName,-1)
xpos=totalRange(:,2);
track=totalRange(:,1);
frame=totalRange(:,3);
And this is the error I received:
Attempted to access totalRange(:,2); index out of bounds because
size(totalRange)=[65,1].
Error in userxlsread (line 5)
xpos=totalRange(:,2);
Note: In the Excel spreadsheet, the columns that contain the data the user wants are not necessarily adjacent to each other.
When I try the code with columns that are right next to each other, it works. However I would like to get it to work so that the columns of data do not have to be right next to each other.
Thank you.