Can this if (size(cost,1) == 2 && size(limit,1) == 2) expression be used? Because I want to take the data from cost table and limit table. The cost table is 4 by 3 table and limit table is 4 by 2 table. So i want to take the data (which are input from user) from limit table. I have this code:
if P1 < limit(1,1)
P1 = limit(1,1);
lambdanew = P1*2*cost(1,3) + cost(1,2);
I can execute my program only if the user inserts the data into limit table but if the user did not insert the data, so it will be an error saying this:
Index exceeds matrix dimensions.
Error in ==> fyp_editor>Mybutton_Callback at 100
if P1 < limit(1,1)
So my question is how I can make if statement for the limit table if the user did not enter the data?
Is it limit(0), limit = 0 or limit == 0??
Can you initialize the limit table somehow so you know it exists but that the user didn’t enter any information in it? If limit table is 4 by 2, try
limit = zeros(4,2). Hope that helps.