MATLAB Answers

0

I'm using old matrix in given data and adding user data to add onto old matrix. Example Days(16x1), Location(16x5), LocationID(1x5) and when user inputs a day its supposed to add onto Days, Same with new location and LocationID.

Asked by Cody Abt on 15 Sep 2019 at 18:13
Latest activity Answered by Walter Roberson
on 15 Sep 2019 at 21:12
My Code at the moment
D2=input('You continue to do research 5 days after the 60th day. Enter the day')
NL=input('Enter the new location ID','s')
I2=input('Enter Ice Data Collected')
Days2=[Days;D2]
LocationID2=[LocationID';NL]
LocationID2'
Ice2=vertcat(Ice,I2)
fprintf('On Day %d, at NL %s, the ice thickness was %0.4f [m]',Days2(D2),LocationID2(NL),Ice2(D2,NL))
I get at the end of this running operation Index exceeds the number of array elements (17).

1 Answer

Answer by Walter Roberson
on 15 Sep 2019 at 21:12

Days2(D2)
D2 contains day numbers such as 52 and 60, but there are only 16 (before additional data) or 21 (after additional data) of them. For example day number 52 corresponds to row 15. When you index Days2 you need to be indexing according to row number, not according to day number.

  0 Comments

Sign in to comment.