Home » Community » Newbie corner » Problem in example code (Tried SplitterFrame yet minor problem.)
Re: Problem in example code [message #45884 is a reply to message #45881] |
Tue, 19 January 2016 21:16   |
|
vegaonline wrote on Tue, 19 January 2016 10:27(i) I want to read a csv data file and take into U++ vector. Can I do like C++ vectors which is easy?
As Koldo already said, there is many ways. I like this one:
FileIn f("/path/to/my.file");
String ln = f.GetLine();
String val1, val2;
Vector<double> x, y;
while( !f.IsEof()) {
SplitTo(ln, '\t', val1, val2); // for tab delimited values, change delimiter as needed
x.Add(StrDbl(TrimBoth(val1)));
y << StrDbl(TrimBoth(val2)); // this is same as y.Add, just bit easier to read in some cases
ln = f.GetLine();
}
vegaonline wrote on Tue, 19 January 2016 10:27(ii) When I try to put items in droplist associated to a layout, I see nothing. Pl. see last attachment.
You are actually doing it right in your code: doPlot.pltType.Add(0,"2D");
doPlot.pltType.Add(1,"3D");
doPlot.pltType.Add(2,"Contour");
The problem is, that this pice of code is in function doPlt, that is never called, so all the initialization it should perform never happens. move the DropList initialization to the constructor of your class and it will work as expected.
Best regards,
Honza
PS: I'm sorry it took me so long to answer. Those two questions required me to look in to the code and test it, so it took longer than simple questions that I can answer from top of my head.
|
|
|
Goto Forum:
Current Time: Sun May 04 22:45:36 CEST 2025
Total time taken to generate the page: 0.03242 seconds
|