Clear Filters
Clear Filters

Why can't I import predictor and response variables in neural network fitting app?

7 views (last 30 days)
Hello.
I'm pretty new to matlab. Whenever i am trying to import predictor variable in my neural network fitting app, the data is being imported to both predictor and response. Saame is happening when I try to import data for response variable. Also the command window is showing an error message.
Warning: Synchronous evaluation of the uiimport function for spreadsheet files will be deprecated in a future
release. Use the asynchronous uiimport syntax instead.
What can I do to fix this?

Answers (1)

Rahul
Rahul on 27 Feb 2023
Edited: Rahul on 27 Feb 2023
The predictors and the responses supports the numeric datatype only. You can go through the following code for your reference.
%% read the fisheriris dataset
% read more about fisheriris dataset here:
% https://en.wikipedia.org/wiki/Iris_flower_data_set
% The following command loads 150 samples of feature set in variable 'meas'
% and responses in variable 'species'. The species contains 50 samples of each
% classes viz., "setosa", "versicolor", "virginica".
load fisheriris.mat
%% Convert responses to numeric datatype
species_num = zeros(length(species), 1); % initializing the numeric response variable
for ii = 1 : length(species_num)
if species{ii} == "setosa"
species_num(ii) = 1; % assigning 1 to "setosa" class
elseif species{ii} == "versicolor"
species_num(ii) = 2; % assigning 2 to "versicolor" class
else
species_num(ii) = 3; % assigning 3 to "virginica" class
end
end
Then type "nftool" in the command window and import the data. Now, you should be able to select Predictors as 'meas' and Responses as 'species_num'. Select Observations in Rows.
Addressing the warning Warning: Synchronous evaluation of the uiimport function for spreadsheet files will be deprecated in a future release. Use the asynchronous uiimport syntax instead, https://www.mathworks.com/matlabcentral/answers/75340-xlsread-uiimport-error-at-238 hints that the issue might possibly relate to command line access being blocked at the time. Alternatively, you can switch to in-built commands such as "readtable", or "readmatrix" instead of "uiimport".

Community Treasure Hunt

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

Start Hunting!