Keeping data imported from excel

조회 수: 4 (최근 30일)
Chris Jordan
Chris Jordan 2015년 5월 11일
댓글: Thomas Koelen 2015년 5월 11일
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
Chris Jordan
Chris Jordan 2015년 5월 11일
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 2015년 5월 11일
haha, happens to all of us :)

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

답변 (1개)

Thomas Koelen
Thomas Koelen 2015년 5월 11일
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!

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by