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.
1 次查看(过去 30 天)
显示 更早的评论
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 个)
Walter Roberson
2019-9-15
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!