Reputation: 5202
I have a variable classi which is composed out of cells (269x500), it can be found here http://ojtwist.be/data.mat . I'm trying to sum the rows of this matrix so that i get a vector of 269x1. I tried converting the variable to a matrix with cell2mat but this doesn't work. Or matlab sees the sign (-) as a seperate cell. Therefore i can't use sum(classi(:),2)
. My question is now, how can I do this efficiently ?
Thx
Upvotes: 3
Views: 438
Reputation: 38042
Here's how you could do it:
load data.mat
a = sum( cellfun(@str2double, classi), 2);
Upvotes: 2