Click here to Skip to main content
14,325,129 members
   

C#

 
AnswerRe: call enum as argument in Method? Pin
BillWoodruff7-Sep-19 19:01
mveBillWoodruff7-Sep-19 19:01 
AnswerRe: call enum as argument in Method? Pin
OriginalGriff7-Sep-19 20:03
protectorOriginalGriff7-Sep-19 20:03 
AnswerRe: call enum as argument in Method? Pin
Gerry Schmitz8-Sep-19 8:09
mveGerry Schmitz8-Sep-19 8:09 
AnswerRe: call enum as argument in Method? Pin
Sharp Ninja9-Sep-19 4:56
memberSharp Ninja9-Sep-19 4:56 
QuestionVlookup a Value on a CSV file C# Pin
Member 1457406731-Aug-19 9:52
memberMember 1457406731-Aug-19 9:52 
AnswerRe: Vlookup a Value on a CSV file C# Pin
OriginalGriff31-Aug-19 19:55
protectorOriginalGriff31-Aug-19 19:55 
AnswerRe: Vlookup a Value on a CSV file C# Pin
BillWoodruff1-Sep-19 12:00
mveBillWoodruff1-Sep-19 12:00 
Questionreading text file as an array by using streamreader Pin
Member 1457152028-Aug-19 19:37
memberMember 1457152028-Aug-19 19:37 
Text File in Notepad++
1.  Name
2.  Institute
3.  .......................................................................
4.  x  :  y
5.  ......................................................................
6.  9    7 
7.  .......................................................................
8.  Mass(M) : Weight(W) : Time(T) : Velocity(V) : Acceleration(A) : Distance(D)
9.  .......................................................................
10. 4.0 5.0 3.56 4.78 5.098 2
11. 5.0 6.0 4.67 5.87 6.387 3
12. 3.0 4.0 6.49 3.95 5.209 4
13. 4.0 7.0 2.01 6.98 2.039 9
14. 9.0 2.0 5.02 2.94 7.209 2
15. 8.0 2.0 4.02 7.30 8.202 6
16. 5.0 9.0 7.03 3.06 2.049 3
17. 0.5 0.4 0.34 0.34 0.534 9
18. 0.7 0.2 0.53 0.74 0.293 3
19. ........................................................................
20.
21.

Code in C#
using System;
using System.IO;
using System.Globalization;

namespace main
{
 public class project
 {
  public int x, y;
  public matrix MandW, Time, VandA, Distance;
  public string cmt, file, dash;
  public project()
  {
   string filename= "C://user//abc.txt";
   Read(filename);
  }
  public void Read(String pfile)
  {
   file=pfile;
   CultureInfo _ci = CultureInfo.InvariantCulture;
   using (StreamReader _sr = new StreamReader(pfile))
   {
    string[] values;
    cmt = _sr.ReadLine();    /* reading keyword Name */
    cmt = _sr.ReadLine();    /* reading keyword institute */
    dash = _sr.ReadLine();    /* reading ............*/
    cmt = _sr.ReadLine();    /* reading x  : y */
    dash = _sr.ReadLine();   /*reading ..............*/
    values = IO.split_string(_sr.ReadLine());
        x = Convert.ToInt32(values[0]);  
        y = Convert.ToInt32(values[1]);
    dash = _sr.ReadLine(); /*reading ...............*/
    cmt = _sr.ReadLine();  /*reading Mass(M) : Weight(W) :... */
    dash = _sr.ReadLine();
    MandW = new matrix(x,2); /* Mass and Weight Matrix*/
    for (int i= 0, i<x, i++)
    {
      values = IO.split_string(_sr.ReadLine());
      for (int j = 0; j < 2; j++) 
      {
       MandW[i,j] = Convert.ToDouble(values[j], _ci);
      }
    }
    Time = new matrix(y,1);  /* Time matrix*/
    VandA = new matrix(y,2);  /*velocity and acceleration matrix */
    Distance = new matrix(y,1); /* distance matrix */
   }
  }
 }
}

I am having trouble constructing these matrices..
Thank you in advance.

modified 29-Aug-19 3:31am.

AnswerRe: reading text file as an array by using streamreader Pin
OriginalGriff28-Aug-19 19:56
protectorOriginalGriff28-Aug-19 19:56 
AnswerRe: reading text file as an array by using streamreader Pin
Richard MacCutchan28-Aug-19 21:27
protectorRichard MacCutchan28-Aug-19 21:27 
QuestionRe: reading text file as an array by using streamreader Pin
Maciej Los28-Aug-19 21:42
protectorMaciej Los28-Aug-19 21:42 
AnswerRe: reading text file as an array by using streamreader Pin
Maciej Los28-Aug-19 22:32
protectorMaciej Los28-Aug-19 22:32 
AnswerRe: reading text file as an array by using streamreader Pin
BillWoodruff28-Aug-19 23:04
mveBillWoodruff28-Aug-19 23:04 
AnswerRe: reading text file as an array by using streamreader Pin
Gene M10-Sep-19 14:48
memberGene M10-Sep-19 14:48 
AnswerRe: reading text file as an array by using streamreader Pin
Jacek Gajek12-Sep-19 9:35
memberJacek Gajek12-Sep-19 9:35 
QuestionTool to add code in my existing class Pin
Bastien Vandamme28-Aug-19 5:48
memberBastien Vandamme28-Aug-19 5:48 
AnswerRe: Tool to add code in my existing class Pin
Richard MacCutchan28-Aug-19 5:54
protectorRichard MacCutchan28-Aug-19 5:54 
AnswerRe: Tool to add code in my existing class Pin
Richard Deeming28-Aug-19 7:47
mveRichard Deeming28-Aug-19 7:47 
AnswerRe: Tool to add code in my existing class Pin
BillWoodruff28-Aug-19 18:35
mveBillWoodruff28-Aug-19 18:35 
QuestionValidating textbox value against an excel worksheet and append to datagridview Pin
Member 1457117728-Aug-19 4:51
memberMember 1457117728-Aug-19 4:51 
AnswerRe: Validating textbox value against an excel worksheet and append to datagridview Pin
ZurdoDev28-Aug-19 5:20
professionalZurdoDev28-Aug-19 5:20 
AnswerRe: Validating textbox value against an excel worksheet and append to datagridview Pin
OriginalGriff28-Aug-19 5:23
protectorOriginalGriff28-Aug-19 5:23 
GeneralRe: Validating textbox value against an excel worksheet and append to datagridview Pin
BillWoodruff28-Aug-19 18:49
mveBillWoodruff28-Aug-19 18:49 
AnswerRe: Validating textbox value against an excel worksheet and append to datagridview Pin
BillWoodruff28-Aug-19 18:46
mveBillWoodruff28-Aug-19 18:46 
GeneralRe: Validating textbox value against an excel worksheet and append to datagridview Pin
Member 1457117728-Aug-19 21:21
memberMember 1457117728-Aug-19 21:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.