Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2902
| From | Eric Cousineau <eacousineau@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Import[...] - MAT files, unable to access variable's data via /. (Replace[...])? |
| Date | 2011-06-02 23:10 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <is958o$5ui$1@smc.vnet.net> (permalink) |
This seems like an easy fix, but I can't seem to get Replace[...], or /., to substitute the variables imported from a MAT file. The MAT file contains two variables, 'xdata' and 'ydata'. I import the data using `data = Import["./data.mat", "LabeledData"]` and it yields a set of Rule's for 'xdata' and 'ydata' with their respective data. However, when I try `xdata /. data`, it simply returns `xdata` as a symbol. I have checked that other basic rules work, such as `2 x /. x -> 3` returning `6`. Anyone know what I might be doing wrong? P.S. I am able to access the data via `data[[1,2]]`, but this is hackish and I can't guarantee the order of the variables. I guess another question is (maybe for another post): is there a way to inspect Rule's and extract a variable's data using the variable's name, i.e., `data[["xdata"]]`, or something thereabouts? Or would /. be the best option? I've searched around for manipulating or inspecting rules, but have found nothing conclusive. Thanks and Gig 'em! - Eric
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Import[...] - MAT files, unable to access variable's data via /. (Replace[...])? Eric Cousineau <eacousineau@gmail.com> - 2011-06-02 23:10 +0000 Re: Import[...] - MAT files, unable to access variable's data via Albert Retey <awnl@gmx-topmail.de> - 2011-06-03 08:36 +0000
csiph-web