Illegal use of reserved keyword "else"
7 views (last 30 days)
Show older comments
Hello everyone.
I'm running a code and I get the aforementioned error for the following part:
% process ratings
formatSpec = '%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n';
ratings_matrix = fscanf(fileID, formatSpec, ratings_matrix_size);
if (size(ratings_matrix, 2) > 0)
% check for honeypot question
hp = (ratings_matrix(end,:) == 2 | ratings_matrix(end,:) == 3 | ratings_matrix(end,:) == 4);
if (sum(hp) ~= 0)
disp("Warning: honey-pot check failed.");
index = find(hp, 1);
number_of_dropped_ratings = number_of_dropped_ratings + (size(ratings_matrix, 2) - index + 1);
ratings_matrix = ratings_matrix(:, 1 : index - 1);
number_of_failed_checks = number_of_failed_checks + 1;
end
participant_id_vector = k * ones(1, size(ratings_matrix, 2));
ratings = [ratings; [participant_id_vector; ratings_matrix(3:end,:)]'];
number_of_participants = number_of_participants + 1;
else
nationality(k) = "NULL";
study_level(k) = "NULL";
gender(k) = -1;
age(k) = -1;
end
The error apperas to be in the last else statement but I can't figure out what's wrong. Thank you for your help!
9 Comments
Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!