MATLAB: How can we write the for loop for accessing a table data

for loopif else conditiontable indexing

i want to perform operations on a table data, for that i need to access data of table using its index and again updated value of that index data should be stored at the same position.
  • * For Example: * * A table having 3 columns and 10 rows, i have written following code but its not working,
for i=1:10
for j=1:3
if j==1
x=x<=5
else if j==2
x=x<=15
else
x=x<=25
end
end
end
Please correct my code……

Best Answer

for i=1:10
for j=1:3
if j==1
x(i,j) = x(i,j) <= 5
else if j==2
x(i,j) = x(i,j) <= 15
else
x(i,j) = x(i,j) <= 25
end
end
end
Related Question