Plot Data From Mat File

Plot Data From Mat File

Thanks for the prompt reply. First line is fine, second line gives an error Reference to non-existent field 'times'. Error in tryplot (line 2) plot(S.times,S.counts); In fact any field I try from that struct gives the same error. Also times(:,1) in that expression gives the same error. Typing S.times gives the same error (Reference to non-existent field 'times'). Clicking on the field, however, displays the contents fine. Matlab reports the mat file is a struct.

Saving and Loading MAT-Files. This section explains how to save the variables in your MATLAB session to a binary file called a MAT-file, and how to load them back into your MATLAB workspace. It covers the following: Exporting Data to MAT-Files; Importing Data from MAT-Files; MAT-files are double-precision, binary, MATLAB format files. File exchange and newsgroup access for the MATLAB & Simulink user community.

>>whos Name Size Bytes Class Attributes S 1x1 3570 struct Is this a paradox? Edit: S.filename.times works, plot(S.filename.times,S.filename.counts); also works. I am mystified but I can at least plow on. % Read in structure from mat file. StoredStructure = load('filename.mat');% For fun, let's see what fields this structure has. FieldNames = fieldnames(storedStructure)% No semicolon% You should see counts and times listed in the command window% if they were actually stored there.% Tell user whether or not counts is there. HasField = isfield(storedStructure, 'counts'); if hasField uiwait(helpdlg('Your structure has a field called counts')); else uiwait(helpdlg('Your structure DOES NOT HAVE a field called counts')); end% Tell user whether or not times is there.

HasField = isfield(storedStructure, 'times'); if hasField uiwait(helpdlg('Your structure has a field called times')); else uiwait(helpdlg('Your structure DOES NOT HAVE a field called times')); end Tell me what you observe in the command window and in the message boxes. Many thanks for your feedback and the helpful code.

The answer to your code is that the fields do not exist. Sysinfotools Xlsx Repair Crack on this page. However, fieldNames = filename, so the file has a single field with the name of the file (is that not confusing), which field in turn contains the fields we are talking about. Sean, your code of course works and is the correct answer to my question, although it did not solve my problem. Drury Summerscape Program. That mat file was produced by commercially available software exporting data into a matlab readable file.