Stuart’s MATLAB Videos

Watch and Learn

Setting-Up and Running Toshi’s Blog Post Code to Analyze Tweets About Fake News 1

Posted by Stuart McGarrity,

My colleague Toshi made a very interesting post on Loren’s blog recently about analyzing Twitter. Someone asked if he could give some instructions on how to set up and run his code as it is a bit involved. I thought I could help with a code-along style video going over the steps which include:

  • Downloading the blog post code and data
  • Downloading twitty from the File Exchange
  • Registering an application on Twitter ( to get authentication tokens for API Access
  • Configuring of twitty with the acquired authentication tokens
  • Downloading the AFINN data set text file

Follow me (@stuartmcgarrity) if you want to be notified via Twitter when I post.

Play the video in full screen mode for a better viewing experience.

Here is that string truncation utility function I used.

function strOut = truncStr(strIn,max,addDots)
% Truncate a char array strIn to a max number of characters and optionally add ellipses

if strlength(strIn) > max    
    strOut = extractBefore(strIn,max);
    if addDots
        strOut=strOut + '...';

% Set back to char
if ischar(strIn)

1 CommentsOldest to Newest

dylan2805 replied on : 1 of 1

Hi is it possible for you to teach me with a sample code of how to stream 1000 tweets about ‘nfl’ using the Twitty streamer and saving the data into a mat file ? I’ve got the correct credentials but can’t seem to proceed with streaming and much less saving the tweets.
Thank you for you help

Add A Comment

Your email address will not be published. Required fields are marked *

What is 8 + 10 ?

Preview: hide