Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

mathcad and excel

Status
Not open for further replies.

tanfolio

Mechanical
Apr 26, 2004
22
I have an excel file that has about 19 individual cells that I need to input to Mathcad. The inputs are located in a single columen i.e B2, B4, B5, B9, etc. I then need 13 outputs - the result of performing operations on these variables back into the same excel sheet at various cell locations in the same columne that the input came from i.e. B1, B3, B6, B10...

Mathcad 13's excel add in does this pretty neatly but you are limited to 10 inputs and 10 outputs per matchcad sheed inserted into the excel file. I put several matchcad worksheets into the excel file in attempt to get the required inputs for a particular sheet down to 10. Unfortunately I couldn't breakdown a couple of the mathcad worksheets below 11 inputs required. I thought mathcads reference feature would get me around the 10 input/10 output limitation, but although you can reference a Mathcad worksheet that is live in excel and mathcad recognizes the variable names in the reference worksheet, it returns a value of zero in the referring sheet. Referencing a Mathcad worksheet that is not live works fine. I'm not real versed in Mathcad or excel so there may be a better way to do what I need. Please advise.
 
Replies continue below

Recommended for you

Use indirection. Set up separate arrays elsewhere in your sheet or workbook so that both input and output arrays are contiguous and pass the arrays as single arrays.

TTFN



 
IRstuff, Is this what you mean?

Using the insert-data-file input to read a contiguous array I was able to select the excel tab the input range was on. I then performed some simple operation on this input array in and tried to use the insert-data-file output function to output an array to a different place in the excel file. The option to output to a different place in the excel files is not available. I can output to new file. I suppose I could somehow read the new excel file back into the original but this seems a bit cumbersome. Also it seems that excel needs to be closed for the read and write function to occur so it is not an interactive operation.
 
No, I was thinking that you'd use a separate portion of the Excel spreadsheet to access all the inputs as a contiguous array. Mathcad can then read it as a single vector. It writes the results back to the Excel component as a single vector to another separate region on your sheet. The original column then references the individual answers in the appropriate rows.

An alternative is to read the entire column as a vector and use some clever indexing to access the input values. Perform the operations, write the results into the complete array with some clever indexing or programming. Write the entire array back into Excel

TTFN



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor