convert c# to matlab

convert c# to matlab

Page 1 of 1

3 Replies - 973 Views - Last Post: 12 April 2010 - 07:19 AM Rate Topic: -----

#1 roi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-April 10

convert c# to matlab

Posted 10 April 2010 - 04:17 AM

hi

Pls help me, how to convert c# to matlab?
Is This A Good Question/Topic? 0
  • +

Replies To: convert c# to matlab

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: convert c# to matlab

Posted 10 April 2010 - 08:35 AM

All I can say is you had better get to writing. As far as I know there isn't a piece of software that can do this, and we're surly not going to just rewrite it for you here, we're not a code writing service.
Was This Post Helpful? 0
  • +
  • -

#3 royyyy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-April 10

Re: convert c# to matlab

Posted 12 April 2010 - 04:05 AM

hi sir i want to know how i convert my c# working code in matlab working code pls give me any code inverter or any tips i attach my c# code as well



******************MY WORKING CODE************************
// C# Document
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace TelephoneSimulation
{
    class TelephoneSimulation
    {
        static int var1 = 0;
        static void Main(string[] args)
        {
            int count1 = 0, count2 = 0;
            int CountBusy = 0;
            bool AtoB = false, BtoA = false;
            bool test1 = false, test2 = false;
            int var = 0;
            int var2 = 0, var3 = 0;
            bool value = false, value1 = false, value2 = false, value3 = false;
            int check = 0, check2 = 0;
            int NoOfCalers, NoOfLines, LineA, LineB, loop1 = 0, loop2 = 0, loop3 = 0, loop4 = 0, loop5 = 0, loop6 = 0, BlockedLine = 0, loop7 = 0;
            double temp = 0;
            double[] CallerArrivalTimeA = new double[1000];
            double[] CallerArrivalTimeB = new double[1000];
            double[] NoOfCaller = new double[1000];
            double[] LengthOfCallA = new double[1000];
            int[] line = new int[1000];
            int[] lines = new int[1000];
            int[] arr = new int[1000];
            double[] FreeAt = new double[1000];
            double[] FreeAt2 = new double[1000];
            int[] counter = new int[1000];
            System.Random rnd = new Random();
            Console.WriteLine("Enter Total No of Lines:");
            NoOfLines = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter Total No of Callers:");
            NoOfCalers = int.Parse(Console.ReadLine());
            LineA = NoOfCalers / 2;
            LineB = NoOfCalers - LineA;
            for (int k = 0; k < NoOfLines; k++)
            {
                lines[k] = k + 1;


            }
            for (loop1 = 0; loop1 < NoOfCalers; loop1++)
            {
                CallerArrivalTimeA[loop1] = rnd.NextDouble();
                //    CallerArrivalTimeA[loop1] = CallerArrivalTimeA[loop1]*Math.Exp(10);
            }
            for (loop2 = 0; loop2 < LineB; loop2++)
            {
                CallerArrivalTimeB[loop2] = rnd.NextDouble();
                //  CallerArrivalTimeB[loop1] = CallerArrivalTimeB[loop1] * Math.Exp(12);
            }
            for (loop3 = 0; loop3 < NoOfCalers; loop3++)
            {
                LengthOfCallA[loop3] = rnd.NextDouble();
                //LengthOfCallA[loop3] = LengthOfCallA[loop3] * Math.Exp(4); 
            }
            for (loop4 = 0; loop4 < loop1 - 1; loop4++)
            {
                for (loop5 = loop4 + 1; loop5 < loop1; loop5++)
                {
                    if (CallerArrivalTimeA[loop4] > CallerArrivalTimeA[loop5])
                    {
                        temp = CallerArrivalTimeA[loop5];
                        CallerArrivalTimeA[loop5] = CallerArrivalTimeA[loop4];
                        CallerArrivalTimeA[loop4] = temp;
                    }
                }
            }
            Console.WriteLine("\t\tTime  " + "Line   " + "Length of Call     " + "Free At");
            Console.WriteLine("\t------------------------------------------------------");
            Console.WriteLine("\n");
            Console.WriteLine("\t\t-----------------------");
            Console.WriteLine("\t\tCallers From A to B");
            Console.WriteLine("\t\t-----------------------");
            for (loop7 = 0; loop7 < NoOfCalers; loop7++)
            {

                if (loop7 == 0)
                {

                    line[loop7] = lines[loop7];
                    FreeAt[loop7] = LengthOfCallA[loop7];
                    Console.WriteLine("\t\t" + CallerArrivalTimeA[loop7].ToString("#0.00") + "     " + line[loop7] + "      " + LengthOfCallA[loop7].ToString("#0.00") + "                  " + FreeAt[loop7].ToString("#0.00"));
                }
                else
                {
                    FreeAt[loop7] = LengthOfCallA[loop7] + CallerArrivalTimeA[loop7];
                    FreeAt2[loop7] = LengthOfCallA[loop7] + CallerArrivalTimeA[loop7];

                }
            }
            for (int a = 1; a < NoOfCalers; a++)
            {
                for (int b = 0; b < a; b++)
                {
                    if (CallerArrivalTimeA[a] > FreeAt[b] && FreeAt[b] != 0)
                    {
                        value = true;
                        value1 = false;
                        var = b;
                        FreeAt[b] = 0;
                        CountBusy++;
                        break;

                    }
                    else
                    {

                        value = false;
                        value1 = true;

                        var = b;
                    }

                }

                if (value == true)
                {

                    line[a] = line[var];
                    if (line[a] == 0)
                    {
                        BlockedLine++;
                        value3 = false;
                    }
                    else
                    {
                        value3 = true;
                    }
                }

                else if (value1 == true)
                {

                    line[a] = lines[var+1];

                    if (line[a] == 0)
                    {

                        BlockedLine++;
                        value3 = false;
                    }
                    else
                    {
                        value3 = true;
                    }
                }



                if (value3 == true)
                {
                    if (a == LineA)
                    {

                        Console.WriteLine("\n");
                        Console.WriteLine("\t\t-----------------------");
                        Console.WriteLine("\t\tCallers From B to A");
                        Console.WriteLine("\t\t-----------------------");

                    }

                    Console.WriteLine("\t\t" + CallerArrivalTimeA[a].ToString("#0.00") + "     " + line[a] + "      " + LengthOfCallA[a].ToString("#0.00") + "                  " + FreeAt2[a].ToString("#0.00"));
                    
                }
               
            }
            Console.WriteLine("block:" + BlockedLine);
            Console.WriteLine("busy:" + CountBusy);

            Console.ReadLine();


        }
    }
}

This post has been edited by JackOfAllTrades: 12 April 2010 - 07:18 AM
Reason for edit:: Added code tags.

Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,495
  • Joined: 23-August 08

Re: convert c# to matlab

Posted 12 April 2010 - 07:19 AM

What part of

Quote

we're surly not going to just rewrite it for you here, we're not a code writing service.

did you fail to comprehend? Hire someone if you don't want to do it yourself.

Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1