public override void VisitMatIndElement(MatIndex element)
 {
     Console.WriteLine("matrix index: {0} \n",element.getText());
 }
    public override void VisitMatIndElement(MatIndex element)
    {
        string matindst = element.getText();
        CharEnumerator ce = matindst.GetEnumerator();
        int inc=0;
        ce.MoveNext();
        string matvar = "";
        string matindvar = "";
        int mode = 0;
        while (inc < matindst.Length)
        {
            if (ce.Current.CompareTo('[') == 0)
            {
                mode = 1;
            }
            if( mode == 0 && ce.Current.CompareTo('[')!=0)
            matvar += ce.Current.ToString();
            if (mode == 1 && ce.Current.CompareTo('[')!=0 && ce.Current.CompareTo(']')!=0 )
            {
                matindvar += ce.Current.ToString();
            }
            ce.MoveNext();
            inc++;
        }

        Console.WriteLine("matvariable with index is:{0}", matvar);
        resultMessage += string.Format("matvariable with index is:{0}", matvar)+"\n";
        Console.WriteLine("matvariable's index variable is:{0}",matindvar);
        resultMessage += string.Format("matvariable's index variable is:{0}", matindvar)+"\n";
        matind = matindvar;
        loopmatvar = matvar;
    }