Click here to Skip to main content
12,406,342 members (68,665 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# VB Matlab
I have some code in Matlab which need to be converted to vb or c# but I didn't have any experience on matlab. So if anyone can do this, please help me.

This is the code in matlab:
case ('BCC')
switch orientation;
    % Input oriented;
    case ('io')
        Z = zeros(n,n+m+s+1);
 
        % Objective function of the BCC model: min(0*lambda - epsilon*(s+ + s-) + theta);
        f = [zeros(1,n) -epsilon*ones(1,s+m) 1];
 
        lblambda = zeros(n,1);                % Lower bounds for (n) lambdas;
        lboutput = zeros(s,1);                % Lower bounds for (s) outputs;
        lbinput = zeros(m,1);                 % Lower bounds for (m) inputs ;
        lb = [lblambda; lboutput; lbinput];   % Lower bounds for lambdas, outputs (s+) and inputs (s-);
        for j=1:n
            Aeq = [Y', -eye(s,s), zeros(s,m+1);
                  -X', zeros(m,s), -eye(m,m) X(j,:)';
                  ones(1,n), zeros(1,s), zeros(1,m+1)];
            beq = [Y(j,:)';zeros(m,1);1];
            z = linprog(f,[],[],Aeq,beq,lb);
            Z(j,:) = z;
        end
        Z
 
    % Output oriented;
    case ('oo')
        Z = zeros(n,n+m+s+1);
 
        % Objective function of the BCC_oo model: max(0*lambda + epsilon*(s+ + s-) + theta);
        f = -[zeros(1,n), epsilon*ones(1,s+m), 1];
 
        lblambda = zeros(n,1);                % Lower bounds for (n) lambdas;
        lboutput = zeros(s,1);                % Lower bounds for (s) outputs;
        lbinput = zeros(m,1);                 % Lower bounds for (m) inputs ;
        lb = [lblambda; lboutput; lbinput];   % Lower bounds for lambdas, outputs (s+) and inputs (s-);
        for j=1:n
            Aeq = [-Y', eye(s,s), zeros(s,m), Y(j,:)';
                    X', zeros(m,s), eye(m,m), zeros(m,1);
                    ones(1,n), zeros(1,s+m+1)];
            beq = [zeros(s,1);X(j,:)';1];
            z = linprog(f,[],[],Aeq,beq,lb);
            Z(j,:) = z;
        end
        Z
 
end


Thanks for help!
Posted 22-Nov-10 5:08am
jack_th1.4K
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

function [bank]=loadthem(filename)
 
for (i=1:4)
    bank(:,:,:,i)=im2double(imread([filename '\' sprintf('%.0f', i) '.png']));
end
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Nobody is going to write your code for you. If you want to hire someone, go over to RentACoder.com. Warning! You get what you pay for.

If you want to LEARN to write your own code, start by learning the language.
  Permalink  
Comments
jack_th 23-Nov-10 2:36am
   
Oh! Thank you. I 'll try by myselft first.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

function [bank]=loadthem(filename)
for (i=1:4)
      bank(:,:,:,i)=im2double(imread([filename '\' sprintf('%.0f', i) '.png']));
end
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160730.1 | Last Updated 1 Aug 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100