I have a file myfile.mat exported from octave, it contains three matrices X, Y, U all of them have same size and I want to plot surface U where X, Y are the x and y.
Testing is a process of technical investigation, performed on behalf of stakeholders, that is intended to reveal quality-related information about the product with respect to the context in which it is intended to operate. Report on seminar.
I have created a.mat file (variable) and it contains 2 columns, each one has 11 numbers. I want to plot column 1 (X axis)against column 2 (Y axis). The problem is whenever I try to plot, it gives me a figure with 2 curves.
Both curves have the same X-Axis (numbers ranging from 1 to 11), and the Y-values for the first curves are numbers in my first column, the Y-values for my second curve are numbers in my second column. This is not what I am looking for, What I want is just one curve with X-values from my first column and Y-values coming from the second column. I have tried to change the values for the X axis and Y axis using the 'edit plot', but it is not working. Any idea?I cannot figure out how to make it work.
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. 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. 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. That mat file was produced by commercially available software exporting data into a matlab readable file. Sadly, you do not get to work straight away with simple examples in real life. Thanks to both of you for your feedback.