how to count rows and columns of integers/doubles in a file?

V

Vladimir S. Oka

Martin said:
Keith Thompson wrote:
-snip-


I think this is off-topic, at least I consider the on-topic discussion
finished.

Establishing context, especially for on-topic discussions, is never
off-topic (BTW, discussions on topicality are also always on-topic).
However, since you absolutely must ask:

I see no reason for being touchy about this...
I'm trying to learn and figure
out how to do basic things in C since I'll graduate as an engineer this
summer
Commendable.

(I'm on eigth semester, not a first first year student as "Mark
the child" suggested). Since I'm writing my bachelor project now, I have
plenty of time to learn, to do and make my own exercises or do whatever
I want to learn, (including doing nothing). Usually Matlab is the
preferred choice here but I think C is important to learn, especially
for doing loops.

I'd happily agree that C knowledge isimportant for an engineer, but why
loops specifically?
You don't have a problem with me trying to learn C, now
do you?

That was uncalled for, really.

Don't get me wrong, but you now leave the impression that you only came
here to get what you need, without wanting to give anything back (or
away). This is not how Usenet, or at least this group works. Having
been given lots of good advice, and lots of people having spent
considerable amount of their own time helping you, you can at least
indulge their curiosity.
Because if not, then everything is fine even though this is off-topic.

As I have already said, establishing context, topicality, and etiquette
are never off-topic.
 
?

=?ISO-8859-1?Q?Martin_J=F8rgensen?=

Vladimir said:
Martin Jørgensen wrote: -snip-



I see no reason for being touchy about this...

I thought nobody cared and thought it was a waste of usenet-posts for
those interested in programming. But okay.
I'd happily agree that C knowledge isimportant for an engineer, but why
loops specifically?

Ask mathworks (AFAIR - the company behind Matlab) - Matlab is *REALLY*
slow at doing for-loops etc. I don't know why, since I didn't programmed
Matlab or know how it is programmed. But it is just a fact and also the
reason why I wanted to learn to incorporate C code into Matlab (I did
that recently).
That was uncalled for, really.

Don't get me wrong, but you now leave the impression that you only came
here to get what you need, without wanting to give anything back (or
away). This is not how Usenet, or at least this group works. Having
been given lots of good advice, and lots of people having spent
considerable amount of their own time helping you, you can at least
indulge their curiosity.

Sorry, I thought most people didn't want to read that kind of
information. I have no problem in explaining why I want to learn to
program in C, but since I already wrote that this thread is not for
doing an exercise or to solve a problem for a teacher, I thought that
there was nothing more to discuss.
As I have already said, establishing context, topicality, and etiquette
are never off-topic.

Ok. I hope I explained why I want to learn to program in C then... If
there's anything else, I would like to explain that too...


Best regards / Med venlig hilsen
Martin Jørgensen
 
K

Keith Thompson

Martin Jørgensen said:
Keith Thompson wrote:
-snip-
Not to defend Mark's rudeness, but it might be nice if you told us
just why you're trying to write this program. Is it part of a larger
project? Is it just a personal exercise? A number of people have
spent considerable time helping you with this; knowing what the goal
is might be helpful. (Sorry if you've already explained this; I
haven't followed the thread very closely.)
[snip]
However, since you absolutely must ask: I'm trying to learn and figure
out how to do basic things in C since I'll graduate as an engineer
this summer (I'm on eigth semester, not a first first year student as
"Mark the child" suggested). Since I'm writing my bachelor project
now, I have plenty of time to learn, to do and make my own exercises
or do whatever I want to learn, (including doing nothing). Usually
Matlab is the preferred choice here but I think C is important to
learn, especially for doing loops. You don't have a problem with me
trying to learn C, now do you?

No, of course I don't have a problem with you trying to learn C. Why
would you think that I do?

One person was rude to you. I suggest ignoring him and moving on.
Don't take it out on the rest of us.
 
V

Vladimir S. Oka

Martin Jørgensen opined:
I thought nobody cared and thought it was a waste of usenet-posts for
those interested in programming. But okay.

Oh, dear...
Ask mathworks (AFAIR - the company behind Matlab) - Matlab is
*REALLY* slow at doing for-loops etc.

Are you sure it's not what's /inside/ the loops that's slow? I did my
BSc in Matlab, and some one-liners it provides can be *really*
complex, and therefore "slow". You balance the time it'd take you to
the same in C, with the tried-and-tested Matlab functions...
Sorry, I thought most people didn't want to read that kind of
information.

Well, people actually asked.
I have no problem in explaining why I want to learn to
program in C, but since I already wrote that this thread is not for
doing an exercise or to solve a problem for a teacher, I thought that
there was nothing more to discuss.

And the question was not why you want to learn C, rather what's the sue
of your code. There's a world of difference, and the advice on C
coding may differ significantly depending on application.
Ok. I hope I explained why I want to learn to program in C then... If
there's anything else, I would like to explain that too...

You're too touchy and defensive for a near-graduate...
 
V

Vladimir S. Oka

Ben Pfaff opined:
Vladimir S. Oka said:
[...] I did my BSc in Matlab, [...]

It's amazing what they give out degrees in these days.


Oh, bugger. It's my English again...

FWIW, my thesis was in signal processing. The /simulations/ were done
in Matlab. It also (alas!) wasn't "these days", more of the "those
[were the] days" -- and I'm *not* telling you when *that* was. ;-)

--
BR, Vladimir

It is all right to hold a conversation,
but you should let go of it now and then.
-- Richard Armour
 
M

Michael Mair

Martin said:
Ask mathworks (AFAIR - the company behind Matlab) - Matlab is *REALLY*
slow at doing for-loops etc. I don't know why, since I didn't programmed
Matlab or know how it is programmed. But it is just a fact and also the
reason why I wanted to learn to incorporate C code into Matlab (I did
that recently).

<OT>Most of the time, there is a Matlab way of doing things
that replaces explicit loops and is faster. If you do not
perform huge and lengthy computations, writing error-free
(or nearly so) C Code can take up more time than you ever
save by using the C Code.
The same can be said for string handling and the like and
Perl or python vs. C.

However, C code has one or two things going for it:
1) If you restrict the Matlab parts (i.e. mexFunction()
and mexCallMatlab()) to one or two modules and write the
rest in portable C, you can reuse the code.
2) You essentially know what is happening and it does not
change over time. There have been Matlab releases for which
the old rules no longer held, i.e. Matlab code which had
been optimized to the hilt was slower than straightforward
code (even incorporating loop constructs).

Most of the time, it is a good idea to do a prototype in
Matlab or another script language and verify afterwards
whether some part "has to go C" -- by measuring and
profiling.

Note: Matlab is not exactly the most fun environment to debug
through if you have a really huge Matlab-DLL or mexglx (or
whatever they may be called now) where complex error
situations can occur.
</OT>

Apart from that, the study of C probably will not be in vain.
It may help you to understand concepts, maybe just from
another angle, and gives IMO a very good impression of what
is going on underneath. (View the happy "C is a glorified
assembler debates" in a theatre near you.)

Sorry, I thought most people didn't want to read that kind of
information. I have no problem in explaining why I want to learn to
program in C, but since I already wrote that this thread is not for
doing an exercise or to solve a problem for a teacher, I thought that
there was nothing more to discuss.

No, the reason behind the questions "what are you really trying to
do" and "what or who are you doing this for" is that it gives the
other participants a better perspective -- you might be looking for
the wrong things or, if the whole thing is an exercise put to you,
might misunderstand its educational purpose. With this better
perspective, they are able to help you better -- or they can say
that you should revisit the question at a later time, maybe after
you have learnt more. Hopefully the former, even though the latter
is not necessarily to your detriment.

BTW: You want to learn C; there is one thing you can do around here
easily: Try helping other people asking questions around here; it
helps you understand things better -- and if you get something
wrong, you are told so immediately. Both help learning and
remembering.


Cheers
Michael
 
D

Dave Thompson

I don't know either how to make the VS editors emit spaces instead of
tabs (Anybody else know?). But in preparing a code snippet to be
included in a usenet post I will run it through GNU indent to remove
tabs and indent to 3 spaces.
In VS6 at least:

- Tools / Options / Tabs to control whether tabs or spaces are
inserted for new lines and "shift right" while editing; set separately
for each (desired) file type; also the width of each tab 'stop' (the
width displayed for an actual tab character either inserted or already
present, or the number of spaces inserted for a tab/indent)

- Edit / Advanced / Untabify selection to convert tabs to spaces (or
Tabify to convert leading spaces to tabs) in the file currently being
edited; for the whole file, first Edit / select All

- Edit / Advanced / Show whitespace to see which you've got.


- David.Thompson1 at 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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top