How to translate excel coding into matlab?

I'm having hard time figuring out how to write an operation for this which I can do in excel.
N1=sum(h4:h23)/20,
N2=(19*n1 +TR2)/20,
N3=(19*n2 +TR3)/20,
N4=(19*n3 +TR4)/20
Where TR comes from another column.
Thanks

 채택된 답변

Image Analyst
Image Analyst 2016년 11월 23일

0 개 추천

You need to read the data into MATLAB with xlsread() or readtable(). Then extract the appropriate column into variables h and TR, and define n1, n2, and n3:
numbers = xlsread(filename);
h = numbers(:, 8); % Or whatever.
TR = numbers(:, 9); % or wherever it is....
n1 = 1; % Whatever it is.
n2 = 2; % Whatever it is.
n3 = 3; % Whatever it is.
N1=sum(h(4:23))/20
N2=(19*n1 +TR(2))/20
N3=(19*n2 +TR(3))/20
N4=(19*n3 +TR(4))/20

댓글 수: 1

liu James
liu James 2016년 11월 23일
I would like to do it automatically as I have over 1680 rows to do, is there a way to do it without writing it all out? Thanks.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

질문:

2016년 11월 23일

댓글:

2016년 11월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by