MATLAB Answers

Change the format of an excel spreadsheet using matlab

조회 수: 26(최근 30일)
Wendy Cameron
Wendy Cameron 28 Nov 2018
편집: Andrei Bobrov 28 Nov 2018
I have numerous spreadsheets in the format of tab 2 attached, and I want to convert them to the format of the one in tab 1. Is this possible using matlab, rather than me having to retype in all the numbers again?

  댓글 수: 0

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

채택된 답변

ES
ES 28 Nov 2018
편집: ES 28 Nov 2018
doc xlsread
doc xlswrite
and for Formatting please refer Excel ActiveX

  댓글 수: 0

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

추가 답변(1개)

Andrei Bobrov
Andrei Bobrov 28 Nov 2018
편집: Andrei Bobrov 28 Nov 2018
[data,c] = xlsread('for_Alex.xlsx',2);
out = for_alex(data,c,53,[5,33]);
here for_alex - function:
function out = for_alex(data,c,rows,cols)
cls = cols(1):cols(2);
Baume = data(1:rows,cls-1)';
DOY = data(1:rows,1);
GDD = data(1:rows,2);
Block = c(5,cls)';
Variety = c(3,cls)';
lo = ~isnan(Baume);
[ii,jj] = find(lo);
Vintage = repmat(year(datenum(c(6),'dd.MM.yyyy')),nnz(lo),1);
out = table(Vintage,DOY(jj),GDD(jj),Block(ii),Baume(lo),Variety(ii),...
'v',{'Vintage','DOY','GDD','Block','Baume','Variety'});
end

  댓글 수: 0

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by