필터 지우기
필터 지우기

Problems using different types of Excel Formats

조회 수: 2 (최근 30일)
Rachel
Rachel 2012년 6월 22일
Hi,
I am trying to build a dataset in Matlab that reads different worksheets in an Excel file.
The first worksheet is Labview output with the first column of custom time format hh:mm:ss AM/PM
What I would like to do is use that column of time for each of the following columns of voltage data.
How do I get that time to read into a matrix that can be manipulated?
I want the eventual output to be a cell array in which the first column is a bunch of (nx2) data sets with (time,voltage). For some reason, I am currently getting the time as characters and cannot add or subtract different values.
New to matlab, sorry if that is confusing.
Thanks in advance.
  댓글 수: 2
Leah
Leah 2012년 6월 22일
Do you have the statics toolbox? Datasets are really nice for doing this kind of work. You need your columns to be doubles not strings to perform mathematical operations on them. Do you have the specific error message.
Rachel
Rachel 2012년 6월 22일
I do but have never used it. I can look in to that.
There is no error message, I just don't know how to read in the time values so that I can build an nx2 matrix of numerical data to plot and analyze.

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

채택된 답변

Adam Filion
Adam Filion 2012년 6월 22일
How are you reading the data in? The XLSREAD function will automatically convert anything it sees as a date into a number. Using the following I think you can read in your data and get the desired cell structure.
[~,~,rawdata] = xlsread('testsheet');
dates = repmat(rawdata(:,1),1,length(rawdata(1,2:end)));
readings = rawdata(:,2:end);
cell1 = cellfun(@(x,y) [x,y],dates,readings,'UniformOutput',0);
Note that you can convert these date numbers back into date format using DATEVEC function.

추가 답변 (0개)

카테고리

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