Why do I get " Unable to resolve the name Mdl1b.Partition"

1 次查看(过去 30 天)
I keep getting "Unable to resolve the name Mdl1b.Partition" everytime I read all lines of the Excel file (1000 lines) but when I limit the lines to read to 50 or so it works perfectly. I do not know why doesn't matlab read all the lines? is there a limit to the lines matlab reads?
%reading and defining X and Y
datmi=xlsread('Significant desc.xlsx');
X=datmi(2:100,4:51);
Y=datmi (2:100,2);
%deviding the result data to train and test to draw graphs (which causes the error only when reading all the lines)
cvp=Mdl1b.Partition
The error I get
Error in ploting_ruselt (line 1)
cvp=Mdl1b.Partition
Error in ssvm (line 44)
ploting_ruselt

回答(1 个)

Arjun
Arjun 2024-8-26
I understand that you are encountering an error message: ‘Unable to resolve the name Mdl1b.Partition’ and you suspect that there is something related to loading data from an Excel file which is causing such a behaviour.
However, this issue is likely not related to the number of lines you are reading from the Excel file, but rather to how Mdl1b is defined or used in your code. The error message ‘Unable to resolve the name Mdl1b.Partition’ suggests that MATLAB is unable to find or access the Partition property of Mdl1b.
Here are some steps to help you troubleshoot and resolve the issue:
  1. Check the Definition of Mdl1b: Ensure that Mdl1b is properly defined and initialized before you attempt to access its Partition property. If Mdl1b is a model object (e.g., from a machine learning toolbox), it should be created using appropriate functions such as “fitcsvm”, “fitctree”, etc.
  2. Verify the Existence of the Partition Property: Ensure that the Mdl1b object has a Partition property. Not all model objects have this property. If Mdl1b is a cross-validated model (e.g., created with 'CrossVal', 'on'), it should have a Partition property.
  3. Inspect the Model Creation Process: Make sure that Mdl1b is created in a way that supports cross-validation if you intend to use the Partition property. If you are performing cross-validation manually, you may need to create the partition separately using “cvpartition”.
  4. Check for Overwriting or Scope Issues: Ensure that Mdl1b is not being overwritten or modified before accessing its properties. Also, check if Mdl1b is being defined in a different scope (e.g., inside a function) and is not accessible where you are trying to use it.
By ensuring that Mdl1b is properly defined and initialized with the correct properties, you should be able to resolve the error. The issue is not likely related to the number of lines you're reading from the Excel file, but rather with how Mdl1b is being used in your code.
I hope that the suggestions mentioned above will help!

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by