フィルターのクリア

Plotting the content of huge matrix.

3 ビュー (過去 30 日間)
Vira Roy
Vira Roy 2022 年 4 月 29 日
コメント済み: Vira Roy 2022 年 4 月 29 日
Problem: I have a huge 449x10001 dimension matrix and want to make a scatter plot from that. While for loop works good enough for smaller size, plotting this huge matrix is extremely time and resource consuming. (I am aware this is a bad way of coding the problem, sorry)
I have attached a smaller version of the huge matrix here and shown my code below. This code here with matrix dimension 449x50 takes 31 seconds to do the plot. Is there a better way without using a for loop to access the entries and make the plot.
It would be extremely helpful if you can guide someway here. Thank you.
My code(attached are big_mat.mat and yaxis.mat)
x = linspace(1,449,449);
y_ = matfile('yaxis.mat');
spectral_wt = matfile('big_mat.mat');
S_wt = spectral_wt.spectral_wt;
y = y_.y;
for i = 1 : 50
scatter(x,y(:,i),[],S_wt(:,i),'filled')
hold on
colormap default
colorbar
ylabel('Energy')
xticks([0 64 128 192 256 320 384 448])
xticklabels({'\Gamma','M1','M2','M3','X1','X2','X3','R'})
xline([64,128,192,256,320,384,448]);
end

採用された回答

KSSV
KSSV 2022 年 4 月 29 日
編集済み: KSSV 2022 年 4 月 29 日
You need not to use scatter in a loop. You can do all this at one go using scatter or you can use pcolor as shown below.
x = linspace(1,449,449);
y_ = matfile('yaxis.mat');
spectral_wt = matfile('big_mat.mat');
S_wt = spectral_wt.spectral_wt;
y = y_.y;
X = repmat(x,size(y,2),1)' ;
Y = y ;
Z = S_wt ;
pcolor(X,Y,Z)
shading interp
colormap default
colorbar
ylabel('Energy')
xticks([0 64 128 192 256 320 384 448])
xticklabels({'\Gamma','M1','M2','M3','X1','X2','X3','R'})
xline([64,128,192,256,320,384,448]);
  1 件のコメント
Vira Roy
Vira Roy 2022 年 4 月 29 日
Thanks a ton. Really. Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by