MATLAB: How to import data from an excel file and save it as a variable

cleareddataerrorexcelimportvariable

importdata('arm_biomech_hw.csv') t=arm_biomech_hw(:,1)
When ran, this script returns an error reading "reference to a cleared variable." I do not understand how the variable is cleared, considering it is loaded immediately before it is used.

Best Answer

The importdata function (and all file import functions except load) have to have variables in which to put the data they import.
See if something like this works:
arm_biomech_mtx = importdata('arm_biomech_hw.csv');
t = arm_biomech_mtx(:,1);