- You cannot read a .xlsx file properly via fopen. Use xlsread instead.
- You should define "Path" variable as directory path, and "File" variable as the file. Currently, ASDPath is the user.xlsx, which is a file.
- Use the full path to a file, and not just the relative path to current working directory. fullfile(ASDPath, ASDFile), where " ASDPath" should be the "path" todirectory, and " ASDFile" should be the "file" ending with .xlsx
- Add an error check after the fopen to help with debug
My code keeps telling me with an error "Index Exceeds Array Bounds" HELP PLEASE
1 view (last 30 days)
OCDER on 25 Oct 2018
Edited: OCDER on 25 Oct 2018
At line 54:
ASDPath = 'C:\User\Desktop\....\'; %PATH to your file
ASDFile = 'user.xlsx';
[NumData, StrData, AllData] = xlsread(fullfile(ASDPath, ASDFile));
[f, ErrMsg] = fopen(ASDPath, 'r'); %This won't work for xlsx file. okay for txt file.
assert(f > 0, ErrMsg); %If FID < 0, fopen failed. So this will tell you what the error is.