Keeping data imported from excel

4 views (last 30 days)
Chris Jordan
Chris Jordan on 11 May 2015
Commented: Thomas Koelen on 11 May 2015
I have managed to import data from excel but as soon as I try to do anything with those variables I have imported they disappear as if they were never imported. I have tried to save them and then use them but that doesn't work. I've tried to import the entire worksheet as one matrix and also each column as its own vector but nothing seems to work. I have also tried using the import wizard, the uiimport function and the xlsxread function and none seems to work. HELP!!! Here is the code I have written thus far: data=uiimport('Copy of Tensile_Data.xlsx'); clear,clc; time=data(:,1); extension=data(:,2); strain1=data(:,3); laod=data(:,4); tensile_stress=data(:,5); tensile_extension=data(:,6); tensile_strain=data(:,7); position=data(:,8); corrected_position=data(:,9);
  2 Comments
Chris Jordan
Chris Jordan on 11 May 2015
Never mind I managed to figure out what was wrong. All that fiddling and it turns out my clear,clc: was getting rid of my data because of where it was. X0
Thomas Koelen
Thomas Koelen on 11 May 2015
haha, happens to all of us :)

Sign in to comment.

Answers (1)

Thomas Koelen
Thomas Koelen on 11 May 2015
This is how I load my excel sheets:
excelsheet = uigetfile('.xlsx','Select a file');
[num,txt,raw] = xlsread(excelsheet,'main');
I've never had any issues with "variables" disappearing!

Community Treasure Hunt

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

Start Hunting!