cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

READFILE

NormalVector
1-Newbie

READFILE

I'm attempting to use MathCAD to do some data analysis but running into a problem. On the computers in the lab, my data was saved as file format "Microsoft Excel 2007 Workbook" (.xlsx). I'd like to use the READFILE function to extract that data into MathCAD. READFILE is giving me an error when I try to use the original format (.xlsx) but when I save that same file with the version of Excel I have on my computer (Excel 2000, .xls) READFILE works fine. I'd rather not save each of the .xlsx files as .xls because I have quite a few.

Does READFILE not work with that version of Excel?

29 REPLIES 29

Not too sure, but Excel saves *.csv [default]. In Mathcad you must then use the insert component and go to the specifications governing the read. READFILE is an extra from the MATHCAD 11 DAEP [Data Analysis Extension Pack]. If you could save your Excel as *.dat or *.txt, you would then READPRN directly w/o the read component.

jmG

I tried playing around with "Insert Component" but I didn't have much luck with that either. I had considered saving all the Excel files as text files and then using READPRN but I was trying to avoid having to change each file manually. Is there a way to choose a set of files and convert them easily? I only have about 13 different files but I would prefer it if there was a quick solution. If worst comes to worst, I'll just manually save the files as text and go from there.

Not the end of the world, just wondering if there was a quick answer!

I just used Insert>Data>File Input with the Excel 2007 spreadsheet and it "wasn't able to open the file for reading." I tried an Excel 2000 file and it worked fine.

It seems that Excel 2007 is not compatible. = (

MikeArmstrong
5-Regular Member
(To:NormalVector)

What version of Mathcad are you running?

Mike

I just lost this reply when hitting post and the "Use Recovered" button managed to retrieve one letter.

Mike

Oh sorry, I'm using MathCAD 14.

Is something like this what you are looking to do?

Yes that looks like what I need. Each of my 13 Excel 2007 files have signal amplitude data that I would like to analyze. The problem I'm having is READFILE("File Location","Excel") is giving me an I/O error when I try to use the Excel 2007 files but works fine if I open a file up and re-save it as an Excel 2000 file.

MikeArmstrong
5-Regular Member
(To:NormalVector)

Their was a similar post on hear yesterday and I managed to read Excel files into Mathcad.

At first I was recieving the I/O error, but eventually caracked it - the path was incorrect.

Why don't you try posting an example worksheet with some data so we can see where your going wrong.

Mike

MikeArmstrong
5-Regular Member
(To:NormalVector)

Stephen Guimond wrote:

Oh sorry, I'm using MathCAD 14.

Mathcad 14 is compatable with Excel 2007. I use it all the time.

Mike

MIke Armstrong wrote:

Mathcad 14 is compatable with Excel 2007. I use it all the time.

My mistake. I have just tried using the "READFILE" function for an Excel 2007 file and got the I/O error message.

Mike

Alright, here's the sheet and data. I created two different Excel files, one saved as 2000 and the other as 2007. When using READFILE, I choose to not specify the directory and just saved the MC file in the same place as the Excel files.

____________________________________

An interpolation added for the 1rst Fourier period

Hehe, either Stephen or Steven is fine. Thanks for the Fourier analysis! I hadn't tried it yet. How did you import the data into MathCAD? While that file is very useful, it still doesn't answer my original problem with Excel 2007.

The data is just some basic high frequency/low frequency interference on a simple periodic signal.

Stephen Guimond wrote:

Hehe, either Stephen or Steven is fine. Thanks for the Fourier analysis! I hadn't tried it yet. How did you import the data into MathCAD? While that file is very useful, it still doesn't answer my original problem with Excel 2007.

The data is just some basic high frequency/low frequency interference on a simple periodic signal.

Stephem,

Just make sure your Passeport is OK.

It's OK to receive data from foreign software as Excel table, but reading from Mathcad is source of all troubles as well as the version of Windows . My Office 97 research and VB got zapped by Office 2000 ! No way to recover [lost patience trying]. My actual Office 2000 does not recover your Excel 2007 ... no scroll function, hardly the column select, which column select I have transited via ORIGINLAB 7.5 [I could have pasted as "paste table" directly in a Mathcad input table. If colleagues collect data from some equipment, would it possible to have the data saved as *.dat or *.txt ? Mathcad reads those two directly from file. The *.prn was from Labtech [DBase ...] and not sure if compatible with the Mathcad *.prn version ? That does not solve your problem. The READFILE is a module introduced in the Mathcad 11 DAEP [Data Analysis Extension Pack, 2003]. It might read your Excel 2007. Leslie was generous enough to give the coding of READFILE. If you want to try, will be glad. Many more collabs are keen on that stuff and may read you and offer an alternative. Mona as well will be delighted helping.

Not sure if you can easily separate the two components high/low frequency. The other thing is that your signal suffers [invisibly] the digitization noise. A very small "ksmooth" gets rid of that little noise. All that is to say that eventually if you specify more about your project, it will capture interest and participation.

Jean

I think I can make due by saving each file as text, I have a long time to finish what I need to do. The project isn't anything special, I'm an undergraduate in ME and taking a class called "Mechanical Engineering Measurements" and the data comes from two function generators to simulate interference. We just recently started school and it was meant as a project to get familiar with LabVIEW and the function generators. We will be doing some pretty cool stuff in the future though.

Sorry: not Steven but "Stephen"

I have seen that data set before ! ?

MikeArmstrong
5-Regular Member
(To:NormalVector)

Stephen Guimond wrote:

Alright, here's the sheet and data. I created two different Excel files, one saved as 2000 and the other as 2007. When using READFILE, I choose to not specify the directory and just saved the MC file in the same place as the Excel files.

Stephen,

Does your data come from calculations done within Excel?

To make life easier you could just an Embedded Excel object within your Mathcad sheet and past all the Data into that. You could then extract into Mathcad. If you have 7 sets of data you could extract as 7 vectors or as a 7 column Matrix.

Mike

Yeah I was trying to do that but I only fooled around with it for a little and couldn't get it to work. I'll probably try again when I devote more time to writing my report. Like I said to Jean just above, our program (LabVIEW) printed the data out into Excel. I know I could probably do the analysis in Excel but I just like MathCAD.

MikeArmstrong
5-Regular Member
(To:NormalVector)

Stephen,

I currently don't have Mathcad, but will be willing to supply an example of an embedded Excel component in Mathcad if you would like. On another note can you get Labview to save to Excel 2003 as a default?

Mike

Stephen Guimond wrote:

Yeah I was trying to do that but I only fooled around with it for a little and couldn't get it to work. I'll probably try again when I devote more time to writing my report. Like I said to Jean just above, our program (LabVIEW) printed the data out into Excel. I know I could probably do the analysis in Excel but I just like MathCAD.

I'm even more lost: Mathcad 11.2a used to read LABVIEW.

Some guidance/help was given in the former MCAD collab.

It could be the latest Labview ignores the PTC Mathcad .

MikeArmstrong
5-Regular Member
(To:jeanGiraud)

Jean,

I have never used LABVIEW, does it have the option to save the results in a different format than Excel?

I have just created a thread asking the question about Mathcad 14 and Excel compatability, there seems to be major issues.

Mike

Thanks for creating the other post. I believe that you can get LabVIEW to export other file types, I'll try that next time I go to the lab. I think my professor said it can print out data as .txt which would be the most helpful for me. Excel may be problematic though, the computers in the lab have Windows 7 and Excel 2007 installed and even if the data were printed out as Excel 2000, I need to change the file name and possibly add some notes to the data. When I save, does Excel 2007 give me choice as to save it as a previous version Excel file?

Anyways, there are a couple of choices I have to get around the problem (.txt, changing LabVIEW's data output settings). Thanks for the help! I hope the MC 14/Excel 2007 problem gets sorted out.

MikeArmstrong
5-Regular Member
(To:NormalVector)

Stephen Guimond wrote:

When I save, does Excel 2007 give me choice as to save it as a previous version Excel file?

Stephen,

You can set Excel to "SaveAs" *.xls format by default.

In Excel select the Office button / Excel Options / select save tab / select the desired format.

I will post an example of an embedded Excel component if you want? This is how I always use Excel with Mathcad.

Mike

Yeah, could you? I can't quite figure out what settings to choose when I set up the component.

Stephen Guimond wrote:

Yeah, could you? I can't quite figure out what settings to choose when I set up the component.

My Excel 2003 has 34 "save as" options.

Why not try some of *.txt options so you can read back

in NotePad, especially a single column as you had !

Because LavVIEW could send data to Mathcad 11,

it could very well be that their techs have the right

answer.

Jean

MikeArmstrong
5-Regular Member
(To:jeanGiraud)

In my own words, "Inert component" is a glorified idiotic.

Jean,

Come on, inserting an Excel component does have some advantages, even though it can be a bit pedantic. The ability to display results within Mathcad is poor to say the least, thus the reason for the new features in Prime. On the other hand, Excel tables can be formatted and look aesthetically pleasing when displayed in calculations.

On this occasion the object will be used to read in the data, which isn't perfect, but will do the job and only requires a copy and paste.

Because LavVIEW could send data to Mathcad 11,

it could very well be that their techs have the right

answer.

Hopefully the LabVIEW software can save data to a different format.

Mike

MikeArmstrong
5-Regular Member
(To:NormalVector)

Stephen Guimond wrote:

Yeah, could you? I can't quite figure out what settings to choose when I set up the component.

Stephen,

Have a look at the attached worksheet. Sorry if I'm trying to teach you to suck egg's, but it might help other collabs when following through the example.

Cheers

Mike

Nannycare has decided that "suck" shouldn't be displayed in my previous post, hence the ****!!!!!!!

Why?????

Mike

That sucks!

Top Tags