MATLAB: How to load and read these files in matlab
text file
Please help me to load and read this file and convert it to corresponding adjacency matrix.
Best Answer
If you are unsure how to import a certain file ... you can use the import wizard (right click on your file in MATLAB and choose "import data"). Then adjust the settings how you want to import the data and finally on the right side under "import selection" choose "generate script".
For the first file (retweet.txt) - this is a code that should work (which basically has just been copied from the "generate script" result):
%%Initialize variables.
filename = 'retweet.txt';
delimiter = ',';
%%Read columns of data as text:
% For more information, see the TEXTSCAN documentation.
You just have to convert the resulting cell arrays into the type of your choosing. Also here - the "generate script" button creates these lines for you (and will follow the lines I pasted in the beginning).
Best Answer