Use my own .csv with MATLAB sample code; specifically with Wine Classification Example

7 views (last 30 days)
How do I swap out MATLAB sample code for a .csv with my own data?
Specifically, I am looking at the 'Wine Classification' example walks users through how to create a classification nueral network example in MATLAB. It uses the wine_dataset which is pulled directly from MATLAB. However, I imagine the process is similar for other examples
I want to use the same sample code from a CSV instead of the wine_dataset data and run all of the same code. My data is 1,217 records organized as a target column followed by 13 attribute columns. To my knowledge this is exactly how the wine_dataset is organized just with a different number of records.
I have tried csvread, fopen, and a number of other functions.
The original code reads:
[x,t] = wine_dataset;
when I try:
ds = csvread('CellDNA2.csv')
[x,t] = ds;
I get the error message, "Insufficient number of outputs from right hand side of equal sign to satisfy
assignment."
It seems like there should be a simple way to just swap my data in for the sample data but I have spent hours trying to do so and not gotten anywhere. Any help would be greatly appreciated!

Answers (1)

Deepak Kumar
Deepak Kumar on 11 Oct 2019
I'm reffering the documentation link https://www.mathworks.com/help/deeplearning/examples/wine-classification.html to answer your query. Please note that after running the command [x,t] = wine_dataset; the input matrix x is of size and the target matrix t is of size . Here the Input matrix X has thirteen rows, for the thirteen attributes. Note that both X and t have 178 columns. These represent 178 wine sample attributes (inputs) and associated winery class vectors (targets). For your data the size of x will be and that of t will be , where N= no of samples. Arrange your data in the sheet in such a way that the size of x & t satifies the dimension criterion as mentioned. I will be able to help more if you can share your data.

Categories

Find more on MATLAB 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!