16,012,025 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Coralie B (Top 129 by date)
Coralie B
16-Jun-15 2:03am
View
My code is a solution, it works.
And about your reply, you said to me to show you the code I have, and the code I had at this moment, it's in ly question.
Coralie B
15-Jun-15 9:02am
View
Barycentre_z :
It's what I have before I do the sum neither average : my positions, around 600 lines.
Somme pour 20 :
It's what I obtain when I summe data by group of 20 data (which come from Barycentre_z), around 30 lines. (600/20)
Moyenne pour 20 :
It's what I obtain when I divide all values of somme pour 20, by 20 : it's what I have to obtain with the average.
Moy_bar_z :
It's what I obtain at the end of my average...
Coralie B
15-Jun-15 8:52am
View
Moy_bar_z
6251,103873
5449,70667
4648,483038
4007,113094
3210,201759
2429,355278
1690,129554
1008,640477
394,3781388
-143,5151832
-598,2860345
-967,4351327
-1247,5253
-1435,674829
-1530,483277
-1535,570795
-1466,071306
-1341,774274
-1193,114349
-1044,655812
0
0
0
0
0
0
0
0
Coralie B
15-Jun-15 8:51am
View
Moyenne pour 20
793,5217539
793,4827
793,0795692
791,543733
764,2582264
720,5081102
664,0709457
598,730428
525,2031138
446,0387336
364,1177526
279,2386168
192,0044966
102,855337
15,91910253
-59,3001289
-118,5792977
-152,6230309
-159,1729001
-158,8846068
-158,7662274
-158,7664751
-158,7573018
-158,769789
-158,8033307
-158,8132195
-158,8147931
Coralie B
15-Jun-15 8:51am
View
Somme pour 20
15870,43508
15869,654
15861,59138
15830,87466
11974,60856
10504,06228
8920,774673
7282,355052
5584,772336
3840,089931
2057,106741
318,3820505
-1186,002578
-2371,585955
-3052,460617
-3183,458002
-3177,692136
-3175,324549
-3175,329502
-3175,146036
-3175,395781
-3176,066615
-3176,26439
-3175,86166
-3176,156509
-3176,295862
Coralie B
15-Jun-15 8:51am
View
Barycentre_z
793,5195847
793,5012283
793,5120659
793,5141335
793,543541
793,5664139
793,5417862
793,5138206
793,485775
793,468998
793,4919357
793,5143852
793,5605545
793,5556831
793,5429459
793,5221901
793,4961166
793,5163803
793,5228043
793,544735
793,553463
793,5285034
793,5216599
793,4957657
793,4922676
793,517704
793,530529
793,5445747
793,5337791
793,5134506
793,4992294
793,475132
793,4817963
793,4707069
793,4811974
793,4586716
793,4102135
793,4006233
793,3840523
793,3606796
793,3767319
793,3855171
793,3636169
793,3158531
793,2700081
793,2549438
793,2374153
793,2268867
793,2174797
793,1958961
793,129055
793,0682297
793,0007782
792,9449158
792,8918228
792,8582954
792,8087616
792,7434807
792,6790123
792,6226845
792,5166054
792,4404259
792,4128036
792,3896904
792,3279419
792,2118835
792,1081848
791,9915619
791,8733292
791,7542686
791,6339149
791,4983063
791,3294868
791,1600456
790,9780617
790,7964935
790,6227684
790,4728012
790,2830963
790,0729904
789,8491631
789,6268272
789,378212
789,1000252
788,8318977
788,5263329
788,1875229
787,7971992
787,386116
786,9290504
786,4379959
785,8827286
785,2577171
784,6143837
783,8979073
783,1242905
782,3257523
781,481678
780,5817032
779,6189232
778,5624924
777,4394531
776,2223663
774,9666634
773,6567383
772,2775536
770,8477936
769,3564072
767,7789001
766,1640244
764,4582901
762,6655045
760,8608246
758,9834976
757,0312271
755,0118217
752,9168663
750,8171654
748,6719856
746,4749527
744,2405586
741,9915466
739,6630669
737,311924
734,9061508
732,4309807
729,933773
727,4210587
724,8427353
722,2602806
719,6165466
716,9647369
714,3009987
711,6264992
708,9709167
706,2721405
703,551609
700,7910538
697,9576111
695,108017
692,241291
689,3961334
686,5336571
683,6578331
680,7682686
677,8187256
674,8672218
671,8858528
668,8981628
665,9049377
662,878109
659,8377914
656,7631531
653,674366
650,5793419
647,4736252
644,3343697
641,1816826
637,9892082
634,7351837
631,4630775
628,1524582
624,7949104
621,441597
618,0762787
614,6556282
611,2047348
607,7260933
604,1986351
600,6916695
597,1775856
593,6737251
590,1740627
586,6520462
583,1032066
579,5335484
575,9418888
572,2927036
568,6520309
565,0026798
561,3029289
557,5445023
553,8214302
550,0660057
546,331953
542,5901661
538,8535595
535,078495
531,2670403
527,4461002
523,6094532
519,7314701
515,8522968
511,9548149
508,0207596
504,0772438
500,099247
496,1326199
492,1450768
488,1371136
484,1382904
480,148838
476,1214924
472,0706844
468,0183048
463,9987135
460,0131788
456,0639172
452,0898123
448,1142168
444,0952234
440,0783987
436,0817747
432,0573263
428,0301075
424,0182018
419,9778624
415,9436293
411,8878984
407,8268013
403,7522116
399,667367
395,5705299
391,4477396
387,2903585
383,0973792
378,8956022
374,7063293
370,4989495
366,3026361
362,1031857
357,8988914
353,6421391
349,4083403
345,1837729
340,954885
336,7690484
332,5892714
328,3917979
324,184617
319,9066211
315,6401675
311,3807096
307,1364915
302,8867259
298,662322
294,3881311
290,1045914
285,8153453
281,5191188
277,2047057
272,8877907
268,5824566
264,3028679
259,9526491
255,5955029
251,2471371
246,8789482
242,5040712
238,1759825
233,8321419
229,5245934
225,1784935
220,8183832
216,4481764
212,0515871
207,6205864
203,1971607
198,7487516
194,282711
189,8287754
185,3651676
180,9052849
176,4728432
172,0135574
167,5855312
163,1710072
158,7539101
154,3510094
149,9402599
145,5038319
141,0639534
136,5862408
132,0802898
127,5227547
122,9710331
118,4548054
113,9910431
109,5285301
105,1010208
100,649931
96,14990425
91,65740967
87,16803741
82,63998032
78,13925934
73,6403904
69,17707062
64,7454567
60,33579826
55,9569416
51,62160683
47,26870441
42,95739365
38,64916515
34,34954357
30,0686388
25,814394
21,60755253
17,43239021
13,31250477
9,219372749
5,108977318
1,046697617
-2,965080261
-6,904607773
-10,83297539
-14,6758256
-18,4493413
-22,20400238
-25,91338253
-29,60839367
-33,25358057
-36,88034296
-40,48026848
-44,04932499
-47,59491897
-51,12528276
-54,63012147
-58,13063574
-61,57121122
-64,98865426
-68,35112846
-71,658775
Coralie B
15-Jun-15 8:09am
View
But I don't know what I have to indicate in my for loop.
I don't know why my code doesn't work. It doesn't make the average, and it seems my code is correct. So I don't know how I can put other things
Coralie B
15-Jun-15 7:35am
View
What I do, follows your idea ?
Coralie B
15-Jun-15 5:55am
View
Where can I put loop ?
Coralie B
15-Jun-15 4:59am
View
In my code, I do what I want ?
I calculate the average Moy_bar_ for each group of 20 data which comes from Baycentre_ ?
Coralie B
15-Jun-15 4:32am
View
What I do it runs. There are no error message.
But I don't average correctly...
Coralie B
15-Jun-15 4:05am
View
I update my question.
Is it the good way ?
But I have an error (in comment of my update question)
Coralie B
29-May-15 2:11am
View
Thank you, your solution runs !
My variable wasn't null.
I've just replaced :
while (line != null) {
by :
while ( (line=reader_trajectoires.ReadLine()) != null) {
And I removed the firt line after while : "line = reader_trajectoires.ReadLine ();"
Thank you :)
Coralie B
27-May-15 7:44am
View
Frame is defined at the very bottom of the code, before void start "int frame;". Its initial value is 0, I declared "frame=0;" at the bottom of void start.
nv_data[i] corresponds to names of markers, and nv_data[i].positions corresponds to data corresponding to the positions of markers. These data come from a text file. nv_data[0].positions.Length = nv_data[i].positions.Length = 41.
Ensemble corresponds to GameObjects what I created in my project. Ensemble[0] corresponds to nv_data[0] etc. If I do it, it's to see the movement of each part through my GameObject Ensemble. Ensemble.Length = 13
Coralie B
26-May-15 5:08am
View
In the part concerning forces (cpt_f, data_f), I try in the loop to take the average of each 10 lines, in group of 3 data
Here an example of a line :
0,00\t-7,81\t-19,48\t81,90
I want to take data without \t
0,00 -7,81 -19,48 81,90 (without " ")
data_f[cpt_f][0] = 0,00 : the time
data_f[cpt_f][1] = -7,81 : the first datum
data_f[cpt_f][2] = -19,48 : the second datum
data_f[cpt_f][3] = 81,90 : the thrid datum
I want the first, the second and the third datum
I take these data by group of 10 lines
I calculate the average
So I can see with debugger, that I have the first line in line_f
But after I have cpt_f = 0
And I have an error with the line :
split_data_F = line_f.Split (new string[] {"\t"}, StringSplitOptions.RemoveEmptyEntries);
The error message is :
NullReferenceException: Object reference not set to an instance of an object
Donnees.Start () (at Assets/Donnees.cs:170)
It's why I think there is a problem with my loop. This doesn't run, and I don't see why it doesn't run.
Coralie B
26-May-15 4:26am
View
Is it more clear ?*
Thank you for your help
Coralie B
26-May-15 4:25am
View
cpt contains data.Length about trajetories which come from the text file : "Suj01_PC_DP_M86.txt" (it's the number of lines which are saved in data[]) : data[cpt]
cpt_f contains data.Length about forces which come from the text file : "Suj01_PC_DP_M86_forces.txt".
And it's for cpt_f that I have 0.
Then, I looked lines_f with debugger, and it has the first line that I want to save in data_F[cpt_F] but it seems that the loop doesn't run.
Coralie B
26-May-15 2:51am
View
Yes there is an error here, I corrected it :
if ((counter % 9) != 1)
continue;
Now the first part run,
cpt = 41 and not = 0
But now it's cpt_F where there is a problem, cpt_F = 0
Coralie B
22-May-15 8:07am
View
int counter = 0;
while (line != null) {
counter++;
line = reader_trajectoires.ReadLine ();
if ((counter % 9) == 1)
continue;
string lines_data;
lines_data = line;
[cpt] = lines_data.Split (new string[] {"\t"}, StringSplitOptions.RemoveEmptyEntries);
cpt ++;
}
I saw with the debugger that in this part, cpt = 0 (ever)
So data[cpt] = null thoughout
But the string lines_data (and also line) has :
"0.04\t0\t0\t0\t-0.407847\t0.824162\t-0.047091\t-0.518739\t0.872472\t0.023845\t-0.615601\t0.928889\t0.143595\t-0.6…"
So we read the line n°3
Thus, we read line but it seems we don't save , and the other problem is that we don't read good line, because we have to read 1 line / 10 ; here we read line[2], so there is a mistake.
Do you see where comes the problem ?
Coralie B
22-May-15 5:58am
View
So what is the problem ?
I've ever used this code for another text file with another form. And it runs... But as soon as I use it differently, for another text file, I have problems
Coralie B
22-May-15 5:56am
View
Thank you for your help, I've just tried your solution, and I have again the same problem..
Coralie B
22-May-15 5:48am
View
I understand what you mean and I try to see what you said.
But in fact, I think the problem with line_f, it's that :
while (line_f != null) {
To my mind, the loop doesn't run at all because the first datum is : 0,00 (it's the time)
How can I write that I want to read all the line of my text file, but when there is 0, I want to continue anyway
Coralie B
22-May-15 4:34am
View
Yes there are some data which = 0
But in the loop I have indicated that the reader runs until the end of the text file : while (line != null)
So how can I indicate I take data until the end of the text file but also I take all data even if = 0 ?
Coralie B
6-May-15 1:56am
View
All data of nv_data[j-1].positions[i].x and nv_data[j-1].positions[i].z won't be saved in x[i] and y[i] ?
Coralie B
5-May-15 8:37am
View
Thank you but can you help me more please ?
I'm going to update my question
Coralie B
5-May-15 2:21am
View
So it's correct this solution.
But at the end I had never the good result in my text file. Therefore, I supposed that the problem came from the line : float delta_x = (((nv_data [59].positions [frame] - nv_data [59].positions [frame - 1]).z) * 0.001f);
even though I put frame-20 instead of frame-1 .
In short, you gave me the good solution for this line. Thank you !
Coralie B
5-May-15 2:17am
View
Actually the problem wasn't about the line that I indicated. So I told you that this line is correct :
float delta_x = (((nv_data [59].positions [frame] - nv_data [59].positions [frame - 1]).z) * 0.001f);
I had tested it with Debug.Log etc ... And I had the good result at this location.
But in the following. It was about the Time.deltaTime . Because before this code, my old code runs with a different frequency. In short I found the solution.
Coralie B
4-May-15 10:03am
View
Actually I have the good code. I just tested.
But I don't have the correct values at the end... when I compare to the older code...
But thank you !
Coralie B
4-May-15 9:38am
View
No I didn't know how can I use breakpoint.
Actually I know to use it but I don't know how I can analyse the result.
I think it's not useful to tell you what exact values I much have because they are float, so there are a lot numbers. I know that I have not the correct values because I did this code in a different script. And I compared the both, and there was no connection.
Coralie B
4-May-15 9:22am
View
I tried but it doesn't run...
I had wrong result again
Coralie B
24-Apr-15 1:57am
View
Do you see my code ?
Thanks very much again in advance :)
Coralie B
22-Apr-15 2:18am
View
Thank you to want to help me.
So I have just send you the full code with some explanations.
Tell me please if you receive this message and if you want some add explanations, tell me.
Coralie B
21-Apr-15 9:09am
View
I don't understand your different points about reasons of the problem.
Can you explain them, please ?
I tried debugger but it seems that it doesn't bring me more details about my problem.
Frankly, I don't now how I can continue.
Coralie B
21-Apr-15 8:41am
View
Deleted
And
Coralie B
21-Apr-15 8:12am
View
I indicate somethings in comments in my code which is in the update question
Coralie B
21-Apr-15 8:11am
View
I modify some things and in particular the frequency that I used for the animation. And now the animation runs but the recording is not correct. I have only one line, corresponding to the fact that the second Debug.Log(frame); shows me only 20 in result.
Coralie B
21-Apr-15 8:01am
View
Look my update question.
Coralie B
21-Apr-15 7:47am
View
The animation doesn't run because I think the code doesn't take 1 line / 20 but all lines so the frequency doesn't good and we can't see anything.
With Debug.Log(frame);
I have either 0 or 0 1 2 3 4 5 6 ... 1 by 1 instead of 1 frame / 20.
I don't understand...
Coralie B
21-Apr-15 4:41am
View
It's right indeed.
I need all lines from the file in void Start.
Then in void FixedUpdate I need to skip some lines : I need 1 line / 20.
But I don't know how I can do it...
I'm sorry to don't explain well
Coralie B
21-Apr-15 4:37am
View
I have to use all of lines in void start.
I have to use 1 line / 20 (so 1 frame / 20) in void FixedUpdate.
But what I did in my code which appears in my question, it doesn't run. So I am searching a solution... But all things what I try , are wrong.
So have you got any ideas to do that ?
Sorry for my previous question "How can I make a different processig in the same code ?" I thought at this moment, that we can to do what I want in void start because I tried already in void FixedUpdate and I didn't arrive to do what I want.
Coralie B
21-Apr-15 4:22am
View
It's what I did, no ?
Coralie B
21-Apr-15 4:15am
View
Why to use a bool here ?
In all of lines of void FixedUpdate I want to use only 1 frame / 20.
Coralie B
21-Apr-15 4:09am
View
I don't understand what I have to do exactly...
Can you explain please ?
Coralie B
21-Apr-15 2:43am
View
I tried already that.
The void start is called only once time, when the code is launched (only at the beginning) so even though I indicate Skip_lines = true in void FixedUpdate, it will change nothing because we don't read again void start.
Do you see what I mean ?
Coralie B
21-Apr-15 2:37am
View
But it doesn't run, I tried these two things.
Actually I don't have to skip lines in void start because I need of all lines in void start for "moindres carrés".
But it's in the second part (in void FixedUpdate) that I need to take only 1 line / 20. So it's here that I have to add somethings.
Indeed, void start is called once time, at the beginning when I launch the code. Thus, if I want something different in void FixedUpdate related to the code presents in void start; I have to add somethings in void FixedUpdate.
I don't know if I am clear :s
In short, I have to indicate I want to take only 1 frame / 20 .
I tried somethings but it doesn't run...
I am going to update my question to show what I did last.
Coralie B
20-Apr-15 9:52am
View
Could you see my update question ?
It's more elaborate I think :)
Coralie B
20-Apr-15 9:33am
View
Finally it doesn't run as I did that... !
It's like Skip_lines = true every time as soon as this part of the code :
if (Skip_lines = true && (counter % 19) != 1)
continue;
I put "Debug.Log (Skip_lines);" when I am at the end of void start and the response is "True" however I never indicate "Skip_lines = true". I indicated the opposite at the beginning of void start.
I think it can't run because I need to save all lines of datas for the first part, but for the second I use only 1 line / 20. But all lines are saved : and in this second part I indicate that I read all datas which saved in my array.
So I think I have to indicate that I take only 1 line / 20 in the second part and not before.
Is it right ?
I tried to do that before, but I didn't arrive.
Can you help me ?
Coralie B
20-Apr-15 9:33am
View
Finally it doesn't run as I did that... !
It's like Skip_lines = true every time as soon as this part of the code :
if (Skip_lines = true && (counter % 19) != 1)
continue;
I put "Debug.Log (Skip_lines);" when I am at the end of void start and the response is "True" however I never indicate "Skip_lines = true". I indicated the opposite at the beginning of void start.
I think it can't run because I need to save all lines of datas for the first part, but for the second I use only 1 line / 20. But all lines are saved : and in this second part I indicate that I read all datas which saved in my array.
So I think I have to indicate that I take only 1 line / 20 in the second part and not before.
Is it right ?
I tried to do that before, but I didn't arrive.
Can you help me ?
Coralie B
20-Apr-15 8:02am
View
Thank you for your help ! :)
Coralie B
20-Apr-15 7:59am
View
I found my solution !
Thank you anyway :)
Coralie B
20-Apr-15 7:52am
View
And after the solution made by @Sinisa Hajnal I add to my code a boolean named "Skip_lines" and now my animation is played too slowly.
You can see my update question with this changing.
Coralie B
20-Apr-15 7:50am
View
I'm going to try.
Actually :
- For void start : I want to take all lines of datas from the text file (for my part names //Processing to calculate the acceleration with "Moindres carrés"
- For void FixedUpdate : I need 1 line of data / 20 to play the animation and to store the datas
Do you see what I mean ?
Thank you to want to help me.
Coralie B
20-Apr-15 7:45am
View
I improved my question with my new code.
Do you see where is it my problem ?
Thank you again.
Coralie B
20-Apr-15 7:31am
View
Thank you .
I need so :
if (shouldSkipLines && (counter % 19) != 1)
continue;
But how I indicate in "traitement pour calculer l'accélération" that I want all lines and in "FixedUpdate" that I want only 1 line / 20 ?
Coralie B
20-Apr-15 7:25am
View
Deleted
I need so :
if (shouldSkipLines && (counter % 19) != 1) // To indicate that we stored only 1 line / 20
continue;
But how I indicate in "moindres carrés" that I want all lines and in "FixedUpdate" that I want only 1 line / 20 ?
Coralie B
20-Apr-15 3:37am
View
I found a solution !
But thank you again :)
Coralie B
20-Apr-15 3:08am
View
I indicate "continue" after "else".
Coralie B
20-Apr-15 3:07am
View
Have you got any other ideas, please ?
Coralie B
20-Apr-15 2:27am
View
Thank you. But it doesn't run.. The code is correct, but when I play the animation, I have the same error message than before : "transform.localPosition assign attempt for 'Left_Elbow' is not valid. Input localPosition is { NaN, NaN, NaN }.
UnityEngine.Transform:set_localPosition(Vector3)"
Coralie B
17-Apr-15 4:19am
View
I have to skip, because otherwise the animation is stopped car it can't to read this data
Coralie B
23-Mar-15 3:47am
View
I have posted a solution.
It runs.
Your solution was very good but there is a problem and I don't arrive to fix it.
Thank you again !
Coralie B
23-Mar-15 3:26am
View
Thanks for your new solution.
But there is a problem :
in : state.speed = speed;
speed in "state.speed" speed is in red...
Coralie B
20-Mar-15 10:43am
View
Ok thank you :)
Coralie B
20-Mar-15 10:36am
View
Thank you very much !
It runs.
But the animation restarts... I assume I make a mistake when I use "animation.Stop".
How can I make a pause ? ( a break in the animation whithout restarting).
Thank you again
Coralie B
18-Mar-15 5:08am
View
Thank you very much ! :D
Coralie B
10-Mar-15 9:58am
View
If I use the debugger at the breakpoint "body[k].transform.position = nv_data[k].positions[i];"
Some items of body[] doesn't exist !
For examples : body[0] exists and from body [1] to body [4] don't exist ! etc ...
Why ? I took the name of GameObject from directly to unity...
And for the string nv_data ... It's disturbing ...
All of value positions are 0 !
But when I used debug.log to see my value positions into the string nv_data (below the lines which allow me to have nv_data.positions) they have so 0 ... But with debug.log we can see positions values of nv_data...
But, for these variables, for their initialization , I did it :
private static Data_struct [] nv_data;
private static GameObject [] body;
"static" allows me to have them in all instances...
So in the debugger, they appear in "static members"
But if I remove "static" nothing changes. There are here again.
So "static" doesn't have any utility here.
I remove it so ?
Coralie B
10-Mar-15 8:41am
View
I'm trying to find the problem, I have added some lines :
void Update () {
for (int i = 0; i < cpt; ++i) {
for (int k = 0; k < body.Length; ++k)
{
if(body == null)
Debug.Log("body is null!");
if(body[k] == null)
Debug.Log("body["+k+"] is null!");
if(body[k].transform == null)
Debug.Log("body["+k+"].transform is null!");
if(nv_data == null)
Debug.Log("nv_data is null!");
if(nv_data[k] == null)
Debug.Log("nv_data["+k+"] is null!");
body[k].transform.position = nv_data[k].positions[i];
Debug.Log(body[1].transform.position);
}
}
}
The errors are :
"body [1] is null !" so my problem is about body[k]
"nv_data is null !" so my problem is about nv_data (it appears when I stop the animation)
"Object reference not set to an instance of an Object" for the line : if(body[k].transform == null)
Coralie B
9-Mar-15 8:50am
View
In generally, we learn swimming with someone who knows how we can do it, no ? During the beginning of the apprenticeship.
And in my case I have to work alone about a purpose which unknown to me.
So, I'm trying to do it and when I was blocked, I asked for help. I thought that was how the forums worked.
Brief, thank you again
Coralie B
9-Mar-15 6:17am
View
Ok, thanks for your all help.
I never thought that this could be bad to ask for help as I did, so thank you again, and my apologies.
Coralie B
9-Mar-15 4:28am
View
So :
My class is : class Data_struct {
My instance is : private Data_struct [] nv_data ;
That's right ?
If it's the case, I have to write :
class Data_struct {
private string nv_data;
public void SetString(string nv_data) { nv_data = nv_data; }
public string GetString() { return nv_data; }
}
Can I call with the same name ?
And I have to call it here ?
void update ()
{
// To associate names_markers to avatar_joints :
GetString(nv_data);
for (int k = 0 ; k < body.Length ; ++k)
body[k].transform.position = nv_data[k].positions[k];
}
Thank you very much
Coralie B
6-Mar-15 8:39am
View
It's exactly this point that I think I'm lost.
When I use a constructor to create an object, I'm creating an instance. But concretely, what is it ?
My instance in my code is
StreamReader reader = new StreamReader ("Suj01_PI_DP_C00_1.txt");
using (reader) {
...
}
?
Thank you again.
I understand what you mean while I'm not english and I begin to understand the structure of c#.
I continue to read websites about this programming while you help me. Some things appear for me more understood than before. So thank you
Coralie B
6-Mar-15 7:56am
View
Thank you;I think I have found a solution thanks to you (of course) !
Actually, I put "private Data_struct [] nv_data ;" after class Data_struct {} so out any function. And I had already removed that in "void start {}".
I didn't have any error now !
But, is that the data entered into nv_Data from " void start {}" are still valid once outside of this function ? Or Nv_data is empty?
I think it's empty. So is there a solution to avoid the destroying, when it's out of the function where it has been completed, of items and datas in nv_Data ?
Thank you again
Coralie B
6-Mar-15 5:57am
View
I put "private Data_struct [] nv_data;" in class Data_struct {}
I have understood that I have to declare this variable not like a local variable. Otherwise, this variable would exist only into the function where it is declared.
Coralie B
6-Mar-15 5:29am
View
Deleted
If I erase "void start ()" at the beginning, is there a solution ?
Coralie B
6-Mar-15 5:17am
View
When I have said "this doesn't run" means that your solution doesn't a solution for my problem. It's ever the same : nv_data doesn't exist at the current context.
I see what you mean. If I ask specific questions, you want to help me ?
If it's the case : my question would be :
How can I make an animation with a variable which has been declared before, out of my function ("void update ()" in my case) ?
Coralie B
6-Mar-15 4:35am
View
Thank you for the solution and your explanation.
But this doesn't run ...
I had never had any course of the programming. I am in training, and it's not really my role to use the programming but I need it to continue the project.
To be honest I really struggle to understang the programming...
Coralie B
5-Mar-15 10:23am
View
Don't worry about me ;)
I think I need your : using (StreamReader reader = new StreamReader ("Suj01_PI_DP_C00_1.txt"))
{
...
}
But how can I use that in my code ?
I have to erase each "line = reader.Readline ()" ?
Here my new question http://www.codeproject.com/Answers/883314/Csharp-Some-errors-in-void-update#answer2
Coralie B
5-Mar-15 10:03am
View
Sorry, but I'm not english and I don't understand what you want to mean.
Can you explain in a different way please ?
Coralie B
5-Mar-15 9:43am
View
Sorry, again.
In my code it has () already. But when I have copied my code, I have erased "void update ()" sans faire exprès (sorry I'm french and I don't know how we can say this expression).
Actually, my problem is nv_data doesn't exist out "using (reader)". And I don't know how I can fix this problem.
Coralie B
5-Mar-15 9:35am
View
I've just updated my question.
Have you seen my code ?
Coralie B
5-Mar-15 9:34am
View
Thank you for your solution.
But I have discovered it's not that the problem actually.
And I assume that we don't need {} if we have only 1 line which depends of this loop. Is it not exact ?
Coralie B
5-Mar-15 9:23am
View
I have just seen my error...
I have integrated "void update" in "using (reader)" and it's not possible.
I'm going to update my question ...
Coralie B
5-Mar-15 9:15am
View
It's wrote : The name 'k' does not exist in the current context
Coralie B
4-Mar-15 4:43am
View
And that ?
List<myawesomeclass> listOfAwesome = new List<myawesomeclass>();
for(int i = 0; i < names.Length; i++)
{
var myClassVar = new MyAwesomeClass();
myClassVar.name = names[i];
myClassVar.axisX = axes[(i*3)];
myClassVar.axisY = axes[(i*3)+1];
myClassVar.axisZ = axes[(i*3)+2];
myClassVar.dataA = datas[(i*3)];
myClassVar.dataB = datas[(i*3)+1];
myClassVar.dataC = datas[(i*3)+2];
listOfAwesome.Add(myClassVar);
}
Coralie B
4-Mar-15 4:20am
View
It's not possible to use this base for making the code ?
Coralie B
4-Mar-15 4:13am
View
Thank you for what you have made.
But, do you think this code is on track ?
// To define one table and its schema
DataTable dt = new DataTable();
dt.column.Add("Name",typeof(string));
dt.column.Add("Axes",typeof(string));
dt.column.Add("Datas",typeof(string));
// To integrate rows
DataRow dr = dt.NewRow();
for (int i=0; i < names.Length; ++i)
dr["Name"]= names[i];
for (int i=0; i < axes.Length; i=i+3)
dr["Axes"]= axes[i];
for (int i=0; i < datas.Length; i=i+3)
dr["Datas"]= datas[i];
dt.Rows.Add(dr);
It's what I try to do...
And if it's possible, I want to do something with my code because I understand this method.
Thank you a much again
Coralie B
4-Mar-15 3:50am
View
Is it correct to do that ?
class Associating
{
static int main(string[] args)
{
// To define one table and its schema
System.Data.DataTable tdata = new System.Data.DataTable();
tdata.Columns.Add("Name", typeof(string));
tdata.Columns.Add("Axes", typeof(string));
tdata.Columns.Add("Datas", typeof(string));
System.Data.DataRow row = tdata.NewRow();
row["Name"]=
row["Axes"]=
row["Datas"]=
}
}
Coralie B
4-Mar-15 3:02am
View
Thank you for your reply.
I'm a beginner in C#, so I have commented that like I thought it was good to learn for myself. Then, I'm not english, so I try to understand what you mean but it's difficult some times.
Can you give me a simple example, please, to how create a class with a Name, three Axes and three Datas ?
P-s : I'm a (young) girl, so at the beginning Sinisa Hajnal, I don't understand that you spoke about me at your reply.
P-p-s : What is "My 5" ? I don't see it anywhere except in your replys
Coralie B
4-Mar-15 2:35am
View
Do you see my current code ?
Coralie B
4-Mar-15 2:28am
View
I want to gather datas which come from different strings.
For example :
The first data of names is : Suj01:RIAS
The first 3 datas of axes are : X, Y and Z
The first 3 datas of datas are : -242.807816,1106.551270 and 1097.119385
(The same schema for the rest)
I want to gather that :
Suj01:RIAS
X : -242.807816
Y : 1106.551270
Z : 1097.119385
etc ...
The string names has only 1 line with 63 datas
The string axes has only 1 line with (63*3) datas (ever X, Y and Z repeat 3 times each)
The string datas has several lines with (63*3) datas at each line (per line : there is so 63 groups of 3 datas, and each data corresponds to a data from axes, and each group corresponds to a name)
Do you understand what I explain ?
Coralie B
4-Mar-15 2:22am
View
My code runs. I showed only my current program.
And my question is how can I gather these datas ?
Coralie B
3-Mar-15 10:06am
View
ok thank you.
http://www.codeproject.com/Questions/882507/Csharp-Associate-datas-to-other-datas
Coralie B
3-Mar-15 9:53am
View
It takes 1 line / 2 , 2 times and it takes 1 line / 3 etc ...
Coralie B
3-Mar-15 9:47am
View
Your lines about the loop to get only 1 line / 4; doesn't run . So I tried to modify them :
int counter = 0;
while (line != null) {
counter++;
line = reader.ReadLine();
if ((counter %4) == 1)
continue;
It runs but it takes 1 line / 2 or 1 line / 3
I tried to understand why or to modify... But I don't succeed
Coralie B
3-Mar-15 7:59am
View
Anyway, I want to understand.
Thank you very much, again.
About your program, I erased some lines.I think I need this line :
string[] values_position_X_Y_Z = Matrice_Suj01_PI_DP_C00_1.Split(',',3);
It means that we get datas (separated by a coma) and by group of 3 values ?
Coralie B
3-Mar-15 5:45am
View
Thank you very much.
I can verify that "names" show different names.
Now I'm going to verify the other parameters.
Can you continue to help me when I have any problems ?
You are very kind ! You have succeed to give me a good program where I can understand every line. And I knew to bring some add lines to reach my purpose.
Thank you very much !
Coralie B
3-Mar-15 3:58am
View
It corresponds at what I want ?
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
using System.Text.RegularExpressions;
using UnityEngine;
using System;
public class Recup_donnees_6 : MonoBehaviour {
// When the script instance is being loaded
void Awake ()
{
Application.targetFrameRate = 25; // To indicate : 25 Fps (Frame per rate)
}
class FileReader
{
static void Main()
{
// Create an instance of StreamReader to read from a file
StreamReader reader = new StreamReader ("Suj01_PI_DP_C00_1.txt");
using (reader) { // Automatic Closing of the Stream after working with it , otherwise we would have to write "reader.Close" at the end to close the stream, beneath the last command's line of this part "class FileReader"
string line;
int lineNumber = 10; // The first line of the text file is the number 0
// skip first 10 lines
for (int i = 0; i < lineNumber; i++) {
line = reader.ReadLine();
if (line == null) return; // this ensures that the file has at least 12 lines
}
// at this point our line contains row #10 (Suj01:RIAS,,,Suj01:LIAS,,,Suj01:LIPS,,,Suj01:RIPS,,,Suj01:DSTR,,,Suj01:C7,,,Suj01:RACR,,,)
string line_10;
line_10 = line; // To indicate that the line #10 we read with the string "line" corresponds to the string "line_10"
string[] names = line_10.Split (new char[] {',',',,,'}); // Every name is separating by ',,,' and the first is writing behind ','
line = reader.ReadLine(); // here it is line #11 (Field #,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X)
// parse it and use it however you need
string line_11;
line_11 = line;
string[] axes = line_11.Split(new char[] {'Filed #',','}); // Every axe is separating by ',' and the first is writing behind 'Filed #,'
int counter = 0;
while (line != null) { // Until the end of the text file
counter++;
line = reader.ReadLine(); // here the loop starts getting data
if (counter %4) == 1 continue;
// if it is exactly 1 (lines 1, 5, 9 etc) continue working
// here you're beginning with the lines you need to enter into the matrix
// (1,-242.807816,1106.551270,1097.119385,14.437944,1075.778687,)
string lines_datas; // To create a matrix which contains 1 line / 4 from text file
lines_datas = line;
string[] datas;
datas = lines_datas.Split(','); // Pb : we can't use "Split" when it's a string []
line = reader.ReadLine(); // This needs to be last line in the while so you can continue the loop
}
}
}
}
}
I want to :
- Skip the 10 first lines
- Get names of line n°10 in a string
- Get axes of line n°11 in a string
- Get datas from the line n°12 (and 1 line / 4) in a string []
Coralie B
3-Mar-15 3:33am
View
I explain in comments... It's not clear ?
Coralie B
3-Mar-15 3:20am
View
So it's correct what I do ? If I remove "line=reader.Readline();"
Coralie B
3-Mar-15 3:17am
View
So, it's correct it ?
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
using System.Text.RegularExpressions;
using UnityEngine;
using System;
public class Recup_donnees_5 : MonoBehaviour {
// When the script instance is being loaded
void Awake ()
{
Application.targetFrameRate = 25; // To indicate : 25 Fps (Frame per rate)
}
class FileReader
{
static void Main()
{
// Create an instance of StreamReader to read from a file
StreamReader reader = new StreamReader ("Suj01_PI_DP_C00_1.txt");
using (reader) { // Automatic Closing of the Stream after working with it , otherwise we would have to write "reader.Close" at the end to close the stream, beneath the last command's line of this part "class FileReader"
string line;
int lineNumber = 10; // The first line of the text file is the number 0
// skip first 10 lines
for (int i = 0; i < lineNumber; i++) {
line = reader.ReadLine();
if (line == null) return; // this ensures that the file has at least 12 lines
}
// at this point our line contains row #10 (Suj01:RIAS,,,Suj01:LIAS,,,Suj01:LIPS,,,Suj01:RIPS,,,Suj01:DSTR,,,Suj01:C7,,,Suj01:RACR,,,)
string line_10;
line_10=line;
string[] names = line_10.Split (new char[] {',',',,,'}); // Every name is separating by ',,,' and the first is writing behind ','
string Matrice_Suj01_PI_DP_C00_1; // To create a matrix which contains 1 line / 4 from text file
Matrice_Suj01_PI_DP_C00_1 = line;
string[] values_position_X_Y_Z;
values_position_X_Y_Z = Matrice_Suj01_PI_DP_C00_1.Split(',',3); // Pb : we can't use "Split" when it's a string []
line = reader.ReadLine(); // here it is line #11 (Field #,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X)
// parse it and use it however you need
string line_11;
line_11 = line;
string[] axes = line_11.Split(new char[] {'Filed #',','}); // Every axe is separating by ',' and the first is writing behind 'Filed #,'
int counter = 0;
while (line != null) { // Until the end of the text file
counter++;
line = reader.ReadLine(); // here the loop starts getting data
if (counter %4) == 1 continue;
// if it is exactly 1 (lines 1, 5, 9 etc) continue working
// here you're beginning with the lines you need to enter into the matrix
// (1,-242.807816,1106.551270,1097.119385,14.437944,1075.778687,)
// Do whatever I need to do with the line data
line = reader.ReadLine(); // after you're done, this needs to be last line in the while so you can continue the loop
}
}
}
}
}
Coralie B
3-Mar-15 2:54am
View
Can you explain this comment please ?
// at this point our line contains row #10 (Suj01:RIAS,,,Suj01:LIAS,,,Suj01:LIPS,,,Suj01:RIPS,,,Suj01:DSTR,,,Suj01:C7,,,Suj01:RACR,,,)
It means that we have currently 10 columns ?
I need to separate names.
Can I write it for what I want ?
// at this point our line contains row #10 (Suj01:RIAS,,,Suj01:LIAS,,,Suj01:LIPS,,,Suj01:RIPS,,,Suj01:DSTR,,,Suj01:C7,,,Suj01:RACR,,,)
string line_10;
line_10=line;
string[] names = line_10.Split (new char[] {',',',,,'}); // Every name is separating by ',,,' and the first is writing behin ','
line=reader.ReadLine();
string Matrice_Suj01_PI_DP_C00_1; // To create a matrix which contains 1 line / 4 from text file
Matrice_Suj01_PI_DP_C00_1 = line;
string[] values_position_X_Y_Z;
values_position_X_Y_Z = Matrice_Suj01_PI_DP_C00_1.Split(',',3); // Pb : we can't use "Split" when it's a string []
Coralie B
3-Mar-15 2:41am
View
I don't understand...
Coralie B
3-Mar-15 2:15am
View
Do you see my comment ?
Coralie B
3-Mar-15 2:14am
View
Is it correct ?
Thank you a much.
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
using System.Text.RegularExpressions;
using UnityEngine;
using System;
public class Recup_donnees_5 : MonoBehaviour {
// When the script instance is being loaded
void Awake ()
{
Application.targetFrameRate = 25; // J'indique que la fréquence est de 25 Hz
}
class FileReader
{
static void Main()
{
// ------------- This first part allows me to read in the console and to load in a matrix 1 line / 4 from the 12th line of the text file to the end ------------- //
// Create an instance of StreamReader to read from a file
StreamReader reader = new StreamReader ("Suj01_PI_DP_C00_1.txt");
using (reader) { // Automatic Closing of the Stream after working with it , otherwise we would have to write "reader.Close" at the end to close the stream, beneath the last command's line of this part "class FileReader"
string line;
int lineNumber = 10;
// skip first 10 lines
for (int i = 0; i < lineNumber; i++) { // or : if (ligne == 1 || ((ligne - 1) % 4) != 0) continue
line = reader.ReadLine();
if (line == null) return; // this ensures that the file has at least 12 lines
}
// at this point our line contains row #10 (Suj01:RIAS,,,Suj01:LIAS,,,Suj01:LIPS,,,Suj01:RIPS,,,Suj01:DSTR,,,Suj01:C7,,,Suj01:RACR,,,)
// do whatever you need to do
string Matrice_Suj01_PI_DP_C00_1; // To create a matrix which contains 1 line / 4 from text file
Matrice_Suj01_PI_DP_C00_1 = line;
string values_position_X_Y_Z;
values_position_X_Y_Z = Matrice_Suj01_PI_DP_C00_1.Split(',',3); // Pb : we can't use "Split" when it's a string []
int line_ = reader.ReadLine(); // here it is line #11 (Field #,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X)
// parse it and use it however you need
string line_11;
line_11 = line;
string[] axes = line_11.Split(new char[] {'Filed #',','}); // Every axe is separating by ',' and the first is writing behind 'Filed #,'
int counter = 0;
while (line != null) {
counter++;
line = reader.ReadLine(); // here the loop starts getting data
if (counter %4) == 1 continue;
// if it is exactly 1 (lines 1, 5, 9 etc) continue working
// here you're beginning with the lines you need to enter into the matrix
// (1,-242.807816,1106.551270,1097.119385,14.437944,1075.778687,)
// Do whatever you need to do with the line data
line = reader.ReadLine(); // after you're done, this needs to be last line in the while so you can continue the loop
}
}
}
}
}
Coralie B
2-Mar-15 8:54am
View
I have already do this as soon as I saw this problem...
I indicated that like "string[] line" at the beginning
Coralie B
2-Mar-15 7:39am
View
Thank you very much !
I have ever this problem... Line appears in red
Coralie B
2-Mar-15 4:02am
View
I don't know how I can indicate the counter.
Like this ?
int counter %4==0;
line = reader.Readline();
counter %4==1;
while ...
If line is a string, can I use line=reader.Readline ? I think it's correct only if line is an int, no ?
And I can't use string[] axes = line_11.Split(new char[] {'Filed #',','}); because "Split" appears in red.
Coralie B
2-Mar-15 3:56am
View
Deleted
Is it correct like this ?
int lineNumber = 10;
// skip first 10 lines
for (int i = 0; i < lineNumber; i=i+4) {
If line is a string, can I use line=reader.Readline ? I think it's correct only if line is an int, no ?
And I can't use string[] axes = line_11.Split(new char[] {'Filed #',','}); because "Split" appears in red.
Coralie B
2-Mar-15 2:27am
View
Oui c'est exact.
La ligne de titre et la ligne de texte "X,Y,Z" sont uniques pour chaque ligne de données. Et c'est bien ces lignes de données dont je veux récupérer 1 ligne sur 4. Donc c'est bien ceci que je dois utiliser (pour prendre 1 ligne sur 4) :
int ligne = Convert.ToInt32(sval[0]);
if (ligne == 1 || ((ligne - 1) % 4) != 0) continue;
?
Merci beaucoup !
Coralie B
2-Mar-15 2:24am
View
First, Thank you a much for your program ! It's very great to help me .
How can I do to indicate that I want to read only 1 line / 4 from the beginning of datas lines ?
Then, there are some mistakes in your program.
For example, we can't use "Split" when the int is a [](array, matrix):
string[] axes = line_11.Split(new char[] {'Filed #',','});
Here "Split" appears in red.
Futhermore, you used the int "line" several times. So, in the program it appears wrong, "line" is red.
I need to don't save the number of the lines.
line = reader.ReadLine(); // here the loop starts getting data
while (line != null) {
// here you're beginning with the lines you need ot enter into the matrix
// (1,-242.807816,1106.551270,1097.119385,14.437944,1075.778687,)
1, -> It's the number of line, and for every line that I save, I have to don't get this number and the ","
Your program allows me to organize every data in group ? For each group of 3 datas, it corresponds to a name "Suj01:RIAS", ... and every data corresponds to a position value ? The first to X, the second to Y and the third to Z ? That in a loop ? Until we have saved every 1 line / 4
Coralie B
27-Feb-15 9:51am
View
Sorry, but I don't have softwares at home for programming. And I have to go... So, I could see your response and your program only Monday.
Thank you a much again.
I hope you understand what I explained in french and in english.
You are very kind !
Say you Monday !
Good weekend
Coralie B
27-Feb-15 9:43am
View
Donc je sauvegarde :
- les noms "Suj01:RIAS" etc : tous les noms qui apparaissent
- 1 ligne / 4 concernant les lignes des données (qui débutent à partir de l'indicateur "1,")
Coralie B
27-Feb-15 9:42am
View
I don't want to save these lines :
Suj01_PI_DP_C00_1
Date:,2014/11/06
Time:,14:55:12
Type:,test
Description:,""
Notes:,""
TRAJECTORIES
100.000000,Hz
,Suj01:RIAS,,,Suj01:LIAS,,,Suj01:LIPS,,,Suj01:RIPS,,,Suj01:DSTR,,,Suj01:C7,,,Suj01:RACR,,,Suj01:LACR,,,Suj01:USTR,,,Suj01:T4,,,Suj01:T8,,,Suj01:T12,,,Suj01:L5,,,Suj01:GLAB,,,Suj01:HETP,,,Suj01:RTRA,,,Suj01:LTRA,,,Suj01:RELE,,,Suj01:RELI,,,Suj01:RELT,,,Suj01:RWRI,,,Suj01:RWRE,,,Suj01:RWRT,,,Suj01:RHDE,,,Suj01:RTHU,,,Suj01:RHDI,,,Suj01:LELE,,,Suj01:LELI,,,Suj01:LELT,,,Suj01:LWRI,,,Suj01:LWRE,,,Suj01:LWRT,,,Suj01:LHDE,,,Suj01:LTHU,,,Suj01:LHDI,,,Suj01:RKNE,,,Suj01:RKNI,,,Suj01:RKNT,,,Suj01:RANE,,,Suj01:RANI,,,Suj01:RANT,,,Suj01:RFOF,,,Suj01:RFOE,,,Suj01:RFOI,,,Suj01:RFOB,,,Suj01:LKNE,,,Suj01:LKNI,,,Suj01:LKNT,,,Suj01:LANE,,,Suj01:LANI,,,Suj01:LANT,,,Suj01:LFOF,,,Suj01:LFOI,,,Suj01:LFOE,,,Suj01:LOFB,,,Chariot:CHA4,,,Chariot:CHA2,,,Chariot:CHA1,,,Chariot:CHA3,,,Chariot:CAP1,,,Chariot:CAP2,,,Chariot:CAP3,,,Chariot:CAP4_______ I want to save all of names
Field #,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z____ No
1,-242.807816,1106.551270,1097.119385,14.437944,1075.778687,1095.583008,-44.466446,1267.733887,1105.356445,-128.627472,1277.957642,1108.846191
2,-242.708282,1106.545654,1097.141479,14.532575,1075.795776,1095.581421,-44.284542,1267.713135,1105.405518,-128.476517,1277.957886,1108.822021
3,-242.599960,1106.609131,1097.114502,14.650084,1075.775757,1095.621582,-44.130051,1267.722534,1105.372925,-128.303467,1278.028320,1108.810059
6,-242.280930,1106.522095,1097.184448,15.049384,1075.850952,1095.679077,-43.817863,1267.804565,1105.186646,-127.933144,1278.118042,1108.672241,-120.850731,1060.377686,1369.913696,-103.306267
C'est à partir de la ligne "1," que je veux sauvegarder chaque donnée. Sans sauvegarder "1," : la numérotation de la ligne. Pareil pour les suivantes. Cependant, je sauvegarderai uniquement 1 ligne sur 4, par rapport à ces dernières lignes. Mais en tout il doit y avoir 6000 lignes environ. Et par ligne il y a donc : 3*63 données (je crois). Le 3 correspond aux axes X Y Z. Et 63 au nombre de noms différent.
Coralie B
27-Feb-15 9:20am
View
So the old code if it saves : 1,5,9 etc ... it's good for this detail ! If it concerns only datas lines.
I hope that you see what I want to mean
Coralie B
27-Feb-15 9:15am
View
No it's not what I want to mean.
Every datas line begins with :
1,
2,
3,
4,
.
.
.
6580,
These numbers indicate only the number of the datas line. They are not datas about the positions values. It's not usefull. So I want to don't save these things. But I want to save from just after the first ",".
Then, I begin to save 1 line / 4 only from the first datas line.
The lines before the line about "names" , I don't want to save them.
The line about "names" I want to save it full.
The line about "X" "Y" "Z" so we don't need to save, because you used another thing.
The lines about datas : I have to save only 1 line / 4 to begin with the first line which indicates by "1,"
Coralie B
27-Feb-15 8:59am
View
// Add a variable here
int fpsLap = 0;
// The loop
while (true)
{
// values
if ((values = reader.ReadLine()) == null) break;
// only pass 1st time or when rest of integer division = 0
fpsLap++;
if (fpsLap != 1 && ((fpsLap-1) % 4) != 0) continue;
I integrate these lines in the program ? To save 1 line / 4, it's from the beginning of datas lines (positions values). Is it what you had written ? And I need to don't extract "1," ; "2," ; "3,"; ... value concerning the number of datas line.
About the first lines, I don't need to save these informations. I need from the line where there are names "Suj01:RIAS" ... to the end. But before it's not important and I don't need it.
Thank you a much again, and I had to add "system.data", thank you a much for that too.
Coralie B
27-Feb-15 7:50am
View
Your are extraordinary ! Thank you a much ! It's very great that you help me like this.
I'm going to see this solution in more details after my comment.
But, first I see these problems :
- When I copy your program, these sentences appear in red : (everything between '')
System.Data.'DataTable' tdata = new System.Data.'DataTable'();
tdata.'Columns.Add'("Name", typeof(string));
tdata.'Columns.Add'("X", typeof(double));
tdata.'Columns.Add'("Y", typeof(double));
tdata.'Columns.Add'("Z", typeof(double));
System.Data.'DataRow' row = tdata.'NewRow'();
tdata.'Rows.Add'(row);
And the other 'DataRow'
- And I want to take datas in commands line, but after the line number "1," "2," ... How can I write that for the program ?
- Furthermore, I want to take only 1 line / 4 (because the frequency of the file was 100 Fps, but me in Unity I used 25 Fps). I know how I indicate 25 Fps in the program, but how can I write that detail in the program ?
Thank you a much again !!!
Coralie B
27-Feb-15 4:31am
View
Oh yes ! I understand.
It's the same schema .
But in () I don't understand the meaning. Can you explain that please ? I want to understand . I want to delete in my head the programming blur
Coralie B
27-Feb-15 4:04am
View
I don't know if I understand.
Why text 'Suj01:RIAS' are always in the second position of the array ?
This line contains every name of positions, and these positions corresponds to specific values, at the same order they appear
Coralie B
27-Feb-15 3:23am
View
I explained my last paragraph :
At the end, I want, for example for "Suj01:RIAS", concerning the first data line :
__________________Suj01:RIAS_____________________
____X_________________Y________________Z_________
-242.807816______1106.551270_____1097.119385_____
I want data informations for every label "Suj01:RIAS", "Suj01:LIAS", "Suj01:LIPS", ... according to positions values according to the axes "X" "Y" "Z".
Coralie B
27-Feb-15 3:17am
View
I explain exactly what I have to do for my project :
Actually, I have different text files. The lines which interested me are :
- Line n°10 : ,Suj01:RIAS,,,Suj01:LIAS,,,Suj01:LIPS,,,Suj01:RIPS,,,Suj01:DSTR,,,Suj01:C7,,,Suj01:RACR,,,Suj01:LACR,,,Suj01:USTR,,,Suj01:T4,,,Suj01:T8,,, Suj01:T12,,,Suj01:L5,,,Suj01:GLAB,,,Suj01:HETP,,,Suj01:RTRA,,,Suj01:LTRA,,,Suj01:RELE,,,Suj01:RELI,,,Suj01:RELT,,,Suj01:RWRI,,, Suj01:RWRE,,,Suj01:RWRT,,,Suj01:RHDE,,,Suj01:RTHU,,,Suj01:RHDI,,,Suj01:LELE,,,Suj01:LELI,,,Suj01:LELT,,,Suj01:LWRI,,,Suj01:LWRE,,,Suj01:LWRT,,,Suj01:LHDE,,, Suj01:LTHU,,,Suj01:LHDI,,,Suj01:RKNE,,,Suj01:RKNI,,,Suj01:RKNT,,,Suj01:RANE,,,Suj01:RANI,,,Suj01:RANT,,,Suj01:RFOF,,,Suj01:RFOE,,, Suj01:RFOI,,,Suj01:RFOB,,,Suj01:LKNE,,,Suj01:LKNI,,,Suj01:LKNT,,,Suj01:LANE,,,Suj01:LANI,,,Suj01:LANT,,,Suj01:LFOF,,,Suj01:LFOI,,,Suj01:LFOE,,,Suj01:LOFB,,, Chariot:CHA4,,,Chariot:CHA2,,,Chariot:CHA1,,,Chariot:CHA3,,,Chariot:CAP1,,,Chariot:CAP2,,,Chariot:CAP3,,,Chariot:CAP4
Where I want only names like "Suj01:RIAS" "Suj01:LIAS" ...
- Line n° 11 : Field#,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z, X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z, X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z,X,Y,Z
Where I want positions axes. Every group "X,Y,Z" corresponds to a name like "Suj01:RIAS" ...
- From the line n°12 to the end of the text file : (and 1 line / 4) (It's a sample of 3 datas lines) 1,-242.807816,1106.551270,1097.119385,14.437944,1075.778687,1095.583008,-44.466446,1267.733887,1105.356445,-128.627472,1277.957642,1108.846191, -121.277077,1059.626953,1370.202759,-103.197083,1198.642578,1640.340088,-299.121094,1233.381592,1589.360596,881.018532,12357.533691,1034.538818,1341.618652, NaN,NaN,NaN,152.531693,1191.905396,1236.288818,82.196426,1208.939941,1225.688843,138.768158,1171.405396,1335.364502,187.567688,1088. ... 2,-242.708282,1106.545654,1097.141479,14.532575,1075.795776,1095.581421,-44.284542,1267.713135,1105.405518,-128.476517,1277.957886,1108.822021,-121.214470, ... 1059.845337,1370.132202,-103.143044,1198.702148,1640.381714,-299.018127,1233.573486,1589.335449,82.020554,1135.265381,1605.206299,-131.176544,1086.614258,1540.604126, -89.283218,1250.712646,1548.286255,-80.893433 3,-242.599960,1106. ...
I don't copy all datas because there are lots of lines ... And I don't want to take in the array the number of lines, indicates at the begin of every datas line. "1," "2," "3," ... And every data is a position axe. The first : X, the second : Y and the third : Z. For every group (of three datas). And e group corresponds to a name like "Suj01:RIAS" ...
So I have to list. For example :
Suj01:RIAS
X__________Y_____________ Z
-242.807816_1106.551270__1097.119385
Suj01:LIAS
X___________ Y ...
14.437944____1075.778687 ...
...
For every line / 4
Coralie B
27-Feb-15 3:14am
View
And, I know my program is not completed. But I'm blocked, and I really don't know how I can change it to arrive at what I want. And I don't know where it's wrong about what I want. It's for this reason that I explained every command line in comments. But I don't how I can get ahead. I don't know what command line is good, what I have to modify to achieve.
Coralie B
27-Feb-15 3:10am
View
I'm not english so I don't know if I understand exactly what you want to mean.
For making this program, I read different websites to try to understang how I can do this program.
So, here it's what I tried to do. But considering I had never used the programming, so it's very mystic for me even today. I think I don't arrive to understand the concept of C#. So, StreamReader I just understand that it allows me to read my text file.
Coralie B
27-Feb-15 2:23am
View
Deleted
No, there are several data lines i every text file : approximately 6000. This varies from one text file to another.
I think, I don't understand what do you want to mean.
I am trying to extract datas of every data line (1 line / 4)
Coralie B
27-Feb-15 2:22am
View
No, there are several data lines in every text file : approximately 6000. This varies from one file to another.
I think I don't understand your last question.
I am trying to extract values of every data line. (1 line / 4)
Coralie B
27-Feb-15 2:18am
View
If you can to give me a solution at my project, it would be very great !
I'm very lost. I tried to make this programme but I don't know how I can correct myself... I don't see where I did mistakes...
So, if you can to give me a solution, I will be really happy !
Thank you a much in advance.
Coralie B
26-Feb-15 8:31am
View
The problem is I understand what you mean but I don't know how I can use it in this context...
for (int i = 12; i < matrice.Length; i=i+4)
string[] ListLines = new string[+=matrice[i]];
ListLines[i] = reader.ReadLine();
Is that ?
Coralie B
26-Feb-15 8:13am
View
How can I use "loop" ?
Coralie B
26-Feb-15 7:34am
View
Is there another solution ? To tell that I have to repeat this line eleven times
Show More