The curly brackets are used to enclose cell-arrays (lists) in matlab, not start and end loops and if-clauses, matlab uses nothing to start those and end to close them. So:
for i1 = 1:4,
if x > 0
a(i1) = pi^i1;
a = -23;
also, I would suggest staying away from i and j for indexing, since they are the imaginary unit too, sooner or later it might come and bite you at an inopportune moment, I go with i1, i2, or i_t, i_x...