% Create a tool to generate plots based on the input

clear all
close all
clc

data = input('Enter your vector or matrix: ');

% get data dimensions
[i j] = size(data);

% check for one dimension to be 1; if it is a column transpose it
if i == 1
    disp('You have entered a vector.');
    plotType = input('What type of plot would you like? (''plot'',''bar'',''pie'',''polar''): ');
elseif j == 1
    % transpose (could you a nested if above if we wanted)
    data = data';
    disp('You have entered a vector.');
    plotType = input('What type of plot would you like? (''plot'',''bar'',''pie'',''polar''): ');
else
    disp('You have entered a matrix.');
    plotType = input('What type of plot would you like? (''mesh'', ''meshc'', ''surface''): ');
end

switch plotType
    case 'plot'
        plot(data)
    case 'bar'
        bar(data)
    case 'pie'
        pie(data)
    case 'polar'
        polar(data)
    case 'mesh'
        mesh(data)
    case 'cmesh'
        cmesh(data)
    case 'surface'
        surface(data)
    otherwise
        disp('Invalid plot type...exiting');
        return
end