Elseif statement with large table
1 view (last 30 days)
Show older comments
I have a 4 x 197 table. The first two columns are characters (ID and name), the last two are integers (min and max).
Each ID and name are not unique but a combination of the two is unique within the table. I need to check the table according to the pair "ID & name" and assign a min and max to it, i.e. write it to a new CSV file. Instead of having 197 elseif statements, how can I make an efficient script to accomplish this?
See attached image. Any help is greatly appreciated.
2 Comments
Answers (1)
darova
on 28 Aug 2019
Will it work?
for i = 1:197
i1 = find(newID(i)==ID & newname(i)==name);
newmin(i) = min(i1);
newmax(i) = max(i1);
end
0 Comments
See Also
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!