Plot 10100X3 matrix as a pixel plot.
Afficher commentaires plus anciens
I have a dataset called matrix of size 10100X3. matrix(1) and matrix(2) are the x y coordinates respectively and the matrix(3) value determines the color of the pixel. This format is not working with the image() function. Any ideas on how I can make this work?
fileID1 = fopen('flipmatrix1.txt');
matrixx = fscanf(fileID1, '%f',[3,inf]);
matrixx = matrixx';
fclose(fileID1);
fileID2 = fopen('flipmatrix2.txt');
matrixy = fscanf(fileID2, '%f',[3,inf]);
matrixy = matrixy';
fclose(fileID2);
matrix = [matrixx; matrixy];
qA = matrix(:,1);
qB = matrix(:,2);
time = matrix(:,3);
image( qA, qB, time);
colorbar;
6 commentaires
the cyclist
le 21 Déc 2017
Please be very specific by what you mean by "not working". Does your code fail to run? If so, give us the complete error message. Or maybe it gives an unexpected result? What did you expect, and what is different?
Ideally, upload your data (or a small, representative sample) so that we can directly test your code.
Make it easy for us to help you!
santiago canete
le 21 Déc 2017
the cyclist
le 21 Déc 2017
That does not seem representative to me. If qA is always zero, then I would expect a single line, and if time never changes, I would expect a single color.
So far, the plot seems to reflect that data, so it is not really possible to diagnose your issue, with the information you have given us.
santiago canete
le 21 Déc 2017
the cyclist
le 21 Déc 2017
You are missing my basic point. When I said you should upload representative data, I meant that you should post a sample that should give a result with similar characteristics to what you expect. With the data and the code you shared, I get a plot that looks like this ...

This is exactly the image that I would expect from such data. So, it is not illustrating the problem you are having. We still need more information to help you.
santiago canete
le 21 Déc 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Distribution Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!