Using uigetfile to read in MATLAB array - index exceeds number of array elements
Show older comments
Hi, I'm trying to do somthing that should be quite simple :)
I just want to read in a *.mat file which contains an array using uigetfile and then plot two of the columns of the array against each other.
This is the code:
function ReadDataButtonPushed(app, event)
[file, path] = uigetfile;
if isequal(file,0)
msgbox('Please input data')
else
Data = load(fullfile(path, file));
X = Data(:,2);
Y = Data(:,3);
plot(app.UIAxes, X, Y);
end
I get the error message 'Index exceeds the number of array elements (1).'
Can someone tell me what I am doing wrong? Many thanks.
Accepted Answer
More Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!