clear all, close all, clc, format compact, format long gA=[12 2 33 15 66; 40 54 79 14 14; 88 2 54 30 47; 37 85 92 14 48; 55 19 88 62 37; 33 12 23 17 25; 75 59 40 26 24; 9 20 44 85 88; 45 57 36 25 49; 92 62 46 88 58];answer=0;for m=1:length(A); for n=1:length(A); if rem(A(m,n),1)==0 answer=answer+A(m,n); end endendanswer
MATLAB: Really need help on this question!!!! I want to calculate the sum of all odd number, where do I do wrong
'index exceeds matrix dimensions' error
Best Answer