Optimization Image Creation?

1 view (last 30 days)
denis bertin
denis bertin on 8 Oct 2017
Commented: denis bertin on 8 Oct 2017
Hi everybody, I want to know if it's possible to optimize(make faster upload image) this piece of code? or it is the top? Thank you.
tic
NP1=942;
t = linspace(0, 0.5/2500000, 2001);
A = load (strcat('cappellaingresso1', '_H.asc'));
d = 0.02*(NP1-1);
xx = linspace(0,d,NP1);
figure('visible','off');
h=imagesc(xx,t,A');
toc

Answers (1)

Walter Roberson
Walter Roberson on 8 Oct 2017
There are some minor changes you can make.
When you pass x and y coordinates to imagesc then it ignores everything except for the first and last. That means there is no point computing anything except for the first and last, which saves you from using linspace since you already know the first and last from the linspace parameters.
There is a possibility that you might be able to read the data slightly faster if you already know the number of columns and you know the format of the entries, especially if you know the number of rows as well.
If you were loading images and displaying them many times then you could improve the graphics performance a bit.
  1 Comment
denis bertin
denis bertin on 8 Oct 2017
the matrix is the 2001x942. Please can you write the optimal code?
thank you.

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!