Read in text values from CSV file into matrix

3 views (last 30 days)
Hi, i'm trying to read in a csv file that has a row full of words each in a separate cell.
Current code
clc;
clear;
%Create Matrix
dictionary = [];
dictionary = readtable('Dictionary.csv');
%pick random word
word_index = randi(9876, 1);
disp(word_index);
%selected_word = dictionary(word_index);
The problem is that if I use extractFileText it reads it in as 1x1 string and if I use readtable it reads it in as a 0*9885 table (There are 9885 words in the csv file). I have also tried readmatrix and xlsread
What function would allow me to read in the csv file into the matrix where each word in the csv file is its own element in a 1*9885 matrix?

Accepted Answer

Stephen23
Stephen23 on 22 Aug 2022
READCELL

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!