Search code examples
matlabplotint64

How can I plot int64 values in Matlab?


I am trying to plot a set of int64 numbers in Matlab R2013a.

As an example of what I am trying to achieve is shown below:

array_of_longs = [13286492335502040542 13286492335502040923 13286492335502042285 13286492335502042469 13286492335502042826 13286492335502044792 13286492335502045012 13286492335502046097 13286492335502047200 13286492335502049511 13286492335502050256 13286492335502050559 13286492335502053284 13286492335502055890 13286492335502056026 13286492335502057640];
horizontal_axis = 1:16;
f = figure;
plot(horizontal_axis,array_of_longs,'x')

Unfortunately, all of the x's in the plot appear to be in a straight horizonal line even though the values are different. I have not been able to "zoom in" the y-axis to help show the variation.

Is there a trick or work around to plotting 64 bit integers?

Also, due to budget constraints I am not able to access toolboxes.

Thanks for you help!


Solution

  • I have found a workaround which works for now. I have taken the length of the uint64 array and assigned a random int to each unique uint64 value. Then I have plotted the random values against the x-values. E.g.

    % array_of_longs = {large set of uint64 values}
    unique_longs = unique(array_of_longs);
    num_unique = length(unique_longs);
    random_key = randi([1,num_unique*2],1,num_unique);
    array_keys = ones(1,length(array_of_longs));
    for i=1:length(array_of_longs)
        array_keys(i) = random_key(find(unique_longs == array_of_longs(i)));
    end
    
    f = figure;
    plot(x_values,array_keys,'x');
    

    I will also output a table that maps each uint64 value to its key. Thanks for all your comments.