Plot 10100X3 matrix as a pixel plot.
古いコメントを表示
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 件のコメント
the cyclist
2017 年 12 月 21 日
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
2017 年 12 月 21 日
the cyclist
2017 年 12 月 21 日
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
2017 年 12 月 21 日
the cyclist
2017 年 12 月 21 日
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
2017 年 12 月 21 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!