I wrote a program that takes data from different databases and plots them. However, sometimes one or more of the databases inputting data yields no values from a query.
When this happens, I get an error message,
'index exceeds matrix dimensions'
Right now, my guess on how to solve this is to run a 'for' loop. (I want to remove the null set of data from a data array as well as a 'names' array (for the plot legend))
I have n data sets and a names array with n names.
I want to do:
for i=1:n %Check each database
if dataarray{i}=0 %If the data is null (This might not be the right way to do this...but basically if there IS data...it is stored as a 350x2 double array...and if there is NOT data...its stored as 0 (a double array I believe)
delete ith value from dataarray %I dont know how to do this
delete ith value from namesarray %Also dont know how to do this
n=n-1 %For plotting in the future..we have one less dataset..now n-1 datasets
endend
So thats what I am trying to accomplish. I have been trying to read about error handling from matlab, and have also browsed this forum, but cannot find exactly what I need.
Any help would be great!
Best Answer