Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: changing color plot in a looped figure plotting

$
0
0
You could do:

figure
hold on
for i=3:6:225
    x=xlsread('test.xlsx','Sheet1',['B' int2str(i) ':JB' int2str(i)]);
    y=xlsread('test.xlsx','Sheet1',['B' int2str(i+1) ':JB' int2str(i+1)]');
    if mod(i,18)==3 % 3, 21, ...
        plot(x,y,'g')
    elseif mod(i,18)==9 % 9, 27, ...
        plot(x,y,'b')
    else % that is, if mod(i,18)==15 % 15, 33, ...
        plot(x,y,'r')
    end
end
hold off

Best.

Viewing all articles
Browse latest Browse all 19628

Trending Articles