Clear Filters
Clear Filters

Hello everyone! I have problem at line 8 and it states Wrong input format at line 1. Hope you could help me thank you! Godbless

1 view (last 30 days)
Here is my code:
SPECTF = csvread('ThesisDataW1v3.csv');
labels = SPECTF(:,1);
features = SPECTF(:,2:end);
features_sparse = sparse(features);
libsvmwrite('ThesisDataW1v3SPARSE.csv', labels, features_sparse);
clear all;clc
[label, features] = libsvmread('ThesisDataW1v3.csv');
[N,D] = size(features);
labelList = unique(label(:));
NClass = length(labelList);
And attach also is my data that I want to train(Numbers 1 and 3 there specefies my two labels):
  1 Comment
Rik
Rik on 26 Nov 2019
Edited: Rik on 26 Nov 2019
I would also argue against the use of clear all, if you want to use that at all you should use clearvars.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 26 Nov 2019
You use libsvmwrite() to carefully write out data with proper labels and features, but then you use libsvmread() to read in the original data rather than the label + feature data that you just wrote out.

Categories

Find more on Statistics and Machine Learning Toolbox 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!