read a column from excel sheet to array in matlab , perform operations , plot graph , write the result in successive column in Excel
Show older comments
first, I must express the elements in column 2 (the solar altitude) and 3 (the solar azimuth) as 2 arrays say array 1 and array 2. The number of elements (i.e the array size) of array 1 and array 2 are equal . However the size changes in each sheet of the excel file.
Secondly, I must create 2 new arrays say array 3 and array 4 with the same array size as the former arrays . Array 3 subtracts each element of array 1 from 90 . Array 4 simply copies the elements of Array 2.
Thirdly I must have 2 graphs ploted against their indices .
Finally , write the elements orray 3 and 4 in the columns adjacent to array 1 and 2 in the excel sheet.
When I excecute my code (given below), I get the below error : Index exceeds array bounds.
Shall be grateful if you have a look at my code snippet and let me know where am I going wrong ?
clc; clear all; daynumber = menu('Choose a Day', 'Day 1', 'Day 2', 'Day 3', 'Day 4'); switch (daynumber) case 1 inputA= xlsread('info.xlsx',1,'B3:B18'); alpha = xlsread('info.xlsx',1,'C3:C18'); isrow(inputA); beta(16:1)=90; gamma(16:1)=0; for i=16:1 gamma=inputA(i); beta=beta(i)-alpha(i); end
subplot(2,2,1)
plot (i,beta(i));
subplot(2,2,2);
plot (i,gamma(i));
Accepted Answer
More Answers (1)
rose mary perumattil jose
on 9 Aug 2018
0 votes
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!