Attempted to access data1(:,1); index out of bounds because size(data1)=[0,0].

  • Thread starter Thread starter Engiman
  • Start date Start date
  • Tags Tags
    Bounds Index
Click For Summary
SUMMARY

The forum discussion addresses an error encountered in MATLAB when attempting to access data from a variable named data1. The error message indicates an "index out of bounds" issue due to size(data1)=[0,0], suggesting that the variable is empty. The user successfully processes 6 columns but fails with 8 columns, indicating a potential data loading or initialization issue. The community suggests reviewing the code to ensure that data1 is properly populated before accessing its elements.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of matrix dimensions and indexing in MATLAB
  • Knowledge of data import techniques in MATLAB
  • Experience with debugging MATLAB code
NEXT STEPS
  • Review MATLAB data import functions such as readtable or load
  • Learn about MATLAB matrix initialization and preallocation techniques
  • Investigate MATLAB error handling and debugging practices
  • Explore MATLAB documentation on matrix dimensions and indexing
USEFUL FOR

This discussion is beneficial for MATLAB users, data analysts, and programmers who are troubleshooting data access issues and optimizing their code for handling larger datasets.

Engiman
Messages
1
Reaction score
0
Hi,
I am running a code in MATLAB process 8 columns and over 500 rows of data but i get the above error.
With 6 columns, the code works well. Your help is important.
 
Engineering news on Phys.org
It sounds like its not understanding your data since it says the size is [0,0] when it should be [500,8]. Could you attach the code?
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
751
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K