Loop Through a Cell Array

924 views (last 30 days)
I have a csv file with the data (ignore whitespaces below only for readable):
State, Rain, Sunshine,
Indiana, 52, 25,
Kansas, 45, 22,
Georgia 35, 55,
Texas 22, 30,
Arizona 60, 12,
I need to create a for loop that will step through the cell array State:
State = {'Indiana','Kansas','Georgia','Texas','Arizona'}
for n = 1:numel(states)
and generate a separate plot for Rain vs. Sunshine for each state.
Amanda on 8 May 2013
Yes, I have column of data for each Rain and Sunshine in a spreadsheet. I really need help on this. I've been out this for awhile now.

Sign in to comment.

Accepted Answer

michael scheinfeild
michael scheinfeild on 9 May 2013
Edited: Walter Roberson on 9 May 2013
for k=1:length(State)
//now go on
Walter Roberson
Walter Roberson on 9 May 2013
Are you wanting to produce one graph per state, or are you wanting to produce one graph that has one dot per state? There are other more efficient ways if you want one dot per state combined in a graph.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!