adding colums to text

B

Bill Cunningham

Do you already have the single-column input file or not?
Yes the text file is for the ouput I type in. I type p 12.00 a file that
doesn't exist is created called "data". I type p 12.11 and it is added below
as such.

12.00
12.11

What I was asking in this thread was to append after 12.11 say

24.11

But your are telling me that can be calculated and that's much simpler.

Bill
 
B

Barry Schwarz

Could you give me an example of this? Would you use for ?

int count=0;
What would be the trigger to increment?

You troll much better when you don't post so often. You deliberately
left out your question that my post responded to. And you obviously
chose to ignore what I wrote. What part of "After reading" doesn't
sound like a trigger to you?


Remove del for email
 
B

Barry Schwarz

You're talking about reading. I need to write the data first. I've
considered writing two functions to do this, one to write and one to read. I
need to start writing the data first. I have a program that writes the
single numbers and that's all.

I quote from your first post -

I have a row of values like such, placed in a text file by
fprintf.

I take it you are just lying to us for sport.


Remove del for email
 
K

Keith Thompson

Barry Schwarz said:
I quote from your first post -

I have a row of values like such, placed in a text file by
fprintf.

I take it you are just lying to us for sport.

I'm having difficulty not reaching the same conclusion.

Bill, assuming you're not deliberately trolling, consider this. If
you had originally written something like this:

I have a text file with one floating-point number on each line.
I want to append the cumulative sum and the mean to each line.

For example, given this input:

10.50
10.25
10.00
10.75
11.00

I want to produce this output:

10.50 10.50 10.50
10.25 20.75 10.38
10.00 30.75 10.25
10.75 41.50 10.38
11.00 52.50 10.50

Now I can understand failing to ask a question clearly on the first
try. There's a great deal of skill in asking good questions.

But after multiple attempts to get you to state what you're trying to
do, you have repeatedly failed to significantly clarify anything. You
have evaded or ignored simple direct questions. I'm *still* not
certain that the above is an accurate description.

If you post a question, and somebody asks you a specific question
about your problem, then *answer the question*. If you're unwilling
to help us to understand what you're asking, we can't possibly help
you.

(And if you *are* deliberately trolling, then you're wasting a great
deal of the time of people who are simply trying to help someone
learn. If you find that kind of thing amusing, then I pity you.)
 
K

Keith Thompson

Keith Thompson said:
Bill, assuming you're not deliberately trolling, consider this. If
you had originally written something like this:

I have a text file with one floating-point number on each line.
I want to append the cumulative sum and the mean to each line.

For example, given this input:

10.50
10.25
10.00
10.75
11.00

I want to produce this output:

10.50 10.50 10.50
10.25 20.75 10.38
10.00 30.75 10.25
10.75 41.50 10.38
11.00 52.50 10.50

.... then we could have avoided wasting a good deal of time. (I
inadvertently failed to complete the sentence in the previous post.)

[...]
 
D

Default User

Keith said:
(And if you are deliberately trolling, then you're wasting a great
deal of the time of people who are simply trying to help someone
learn. If you find that kind of thing amusing, then I pity you.)

Same old songs and all that, but I don't know that it matters. Whether
it's a deliberate troll or not, I don't see any progress with Bill over
the years. I believe it is a waste of time regardless. If he's not a
troll, then through mental tics or stubborness Bill is not able to
participate in a meaningful fashion.

I went through this with him months ago. I said that he would need to
stick to one problem, work it through, answer all questions, yadda
yadda. He didn't. I plonked him. I don't even need to worry about him
being a troll.





Brian
 
D

David Thompson

I'm not sure, but I *think* you've finally answered the question I
asked at least twice, if only indirectly.

Each input line contains a number. Each output line contains the
number from the corresponding input line, followed by the sum of all
the input numbers seen so far, followed by the mean of all the input
numbers so far.

Actually that _isn't_ a moving average, but rather a running average.
It is a different, although also sometimes useful, statistic, and
might be just as good to move Bill C a step or two further along --
inasmuch as he seems to have difficulty, that appears to me to be
roughly constant, with any algorithm beyond "hello world".

I note this just in (unlikely) case someone else who does indeed
want/need moving average should happen on this thread.

- formerly david.thompson1 || achar(64) || worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,192
Latest member
KalaReid2

Latest Threads

Top