Unrecognized function or variable 'carsmall'

47 vues (au cours des 30 derniers jours)
Alberto Ongaro
Alberto Ongaro le 23 Mar 2020
Commenté : Alberto Ongaro le 28 Mar 2020
Hello, I'm doing a very basic exercise which starts with importing carsmall.mat dataset and protting its data with gplotmatrix(). Here is the code I wrote:
clear all;
close all;
clc;
%% Initialization
load carsmall.mat;
figure()
gplotmatrix(carsmall');
The problem is that when I run the script I get this output message:
Unrecognized function or variable 'carsmall'.
Error in Exercise_3_1 (line 8)
gplotmatrix(carsmall);
I don't get it. I have the Statistics and Machine Learning Toolbox installed. I'he done the same exercise importing iris_dataset.mat and it all worked fine.
Can anybody please help me? I've also updated anything possible but nothing changed...
Thank you

Réponse acceptée

John D'Errico
John D'Errico le 23 Mar 2020
Modifié(e) : John D'Errico le 23 Mar 2020
This is not a question of you updating your version. I can see what you did, but not what you were hoping to do. Suppose I try this:
load randomstuff.mat
Error using load
Unable to read file 'randomstuff.mat'. No such file or directory.
So, if I try loading a file that does not exist, it gives me an error, telling me the file does not exist, but NOT what you got.
What did you get?
Unrecognized function or variable 'carsmall'.
Error in Exercise_3_1 (line 8)
gplotmatrix(carsmall);
That tells me the load did work, but there is no variable named carsmall in that .mat file.
I would suggest you try this:
load carsmall.mat;
whos
Name Size Bytes Class Attributes
Acceleration 100x1 800 double
Cylinders 100x1 800 double
Displacement 100x1 800 double
Horsepower 100x1 800 double
MPG 100x1 800 double
Mfg 100x13 2600 char
Model 100x33 6600 char
Model_Year 100x1 800 double
Origin 100x7 1400 char
Weight 100x1 800 double
So there is indeed no variable by that name in the .mat file. Lots of other stuff, but not carsmall. What you want to do next is up to you.
  5 commentaires
Walter Roberson
Walter Roberson le 28 Mar 2020
gplotmatrix(iris_dataset');
iris_dataset is a function. In this context it returns the irisInputs variable from iris_dataset . You do not even have to load the dataset first.
My guess is that IF the dataset contains just numerical variables belonging to the same class, then we can call gplotmatrix() putting the name of the dataset inside the brackets;
No, it has nothing ot do with that. It is because iris_dataset is a function that is returning the values.
>> which iris_dataset
/Volumes/T5/T5 Applications/MATLAB_R2020a.app/toolbox/nnet/nndemos/nndatasets/iris_dataset.m
Alberto Ongaro
Alberto Ongaro le 28 Mar 2020
That makes a lot of sense then. Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by