Creating row-concatenated matrix in Matlab

How do I create a concatenated matrix in Matlab which would give the result below?

[0.01 0.01 error1]
[0.01 0.03 error2]
[30 30 error64]

So far, what I have tried is below.

C =  [0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30];
sigma =  [0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30];

m = zeros(64,3);

for ci = C
for si = sigma
    train = svmTrain(X, y, ci, @(x1, x2) gaussianKernel(x1, x2, si));
    pred = svmPredict(train, X);
    error = mean(double(pred ~= y))    
    m = [m ; [C,sigma,error]];    

I expect a 64 X 3 column matrix.


It seems like the code you provided basically does that. You should be starting off with an empty matrix m.

m = []; % Initialize empty result matrix m 

for ci = C
    for si = sigma
        error = % Calculate error here
        m = [m ; [C,sigma,error]];  % concatenate new row onto m.

Need Your Help

Django REST framework - What is the correct way of registering / validating new users?

django serialization django-models django-rest-framework user-registration

I've only started using the Django REST framework recently. I want to create a user. Before (without Django REST framework) I used to create users with the following logic (using the User model in ...

why is it when i place my textview at the bottom of my background bits of the text dissappear into the back background?

android xml android-layout android-listview

I have a basic background and a textview i wish to place at the bottom of the background but when the textview reaches a certain level it starts to disappear into the background the further down i ...