Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

For Loops

Status
Not open for further replies.

msmiley

Computer
Joined
Jul 9, 2001
Messages
5
Location
US
I want to create a for loop that will take information from one Excel database colum and enter it into Mathcad. I then want to manipulate the data the way I want and enter the new data into a new Excel database.
 
Dear msmiley

I use MATHSERV, which you can get from:

This is a powerful BASIC interpreter that works from any document. For example, after creating a .csv file from Excel with three lines and four columns filled by consecutive numbers, I typed the following into Notepad:

chdir "\My Documents"
TEST = fileq("ectest1.csv", _exists) := 1

NUM = freefile := 7
fileopen(NUM, "ectest1.csv")

while not fileeof(NUM)
fileread(NUM, a)
print a
end while
1,2,3,4
5,6,7,8
9,10,11,12

fileclose(NUM)

clear MAT
MAT[1,1:4] = {1,2,3,4}
MAT[2,1:4] = {5,6,7,8}
MAT[3,1:4] = {9,10,11,12}

print MAT
1 2 3 4
5 6 7 8
9 10 11 12

Now that MAT is set up, you have the full range of an extended set of BASIC commands at your disposal, including matmult, matinvert and mattranspose.

Please let me know waht you think.

Helmut
engcomp@pbq.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top