[Date Index] [Thread Index] [Author Index]
Import[...] - MAT files, unable to access variable's data via /. (Replace[...])?
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