Trying to set up a matrix, getting error message
Show older comments
This is my current code, every time I attempt to run it I get an error message that says "Index in position 1 exceeds array bounds." How do I fix this?
Matrix = fscanf(fid, '%f', [3, 4]);
w = Matrix(1,:);
t = Matrix(2, : );
g = Matrix(3, : );
1 Comment
% fid = 0;
% Matrix = fscanf(fid,'%f', [3, 4])
Matrix = [3, 4] % if this is your input Matrix read
size([3 4])
w = Matrix(1,:);
t = Matrix(2, : ); % here is the error where you try to access non-existent row
g = Matrix(3, : );
you try to access non-existent row for the Matrix vector whose size consists of only 1 row
Accepted Answer
More Answers (1)
Walter Roberson
on 2 Feb 2024
0 votes
You have accidentally created a variable named fscanf
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!