I have a loop that plots on figure for each different value of the counter, and each frame is stored in a variable M: for k:..... M(k)=getframe(gcf) end The problem is that M is a structure now and i cant use it with the videofig function from file exchange:
What can I do ?

2 commentaires

Adam
Adam le 4 Oct 2018
So is your question how to use imshow with a structure or how to use the linked file exchange functionality with a structure? They don't seem to be related.
Hi adam, Well if there is a way to use imshow with a structure it will help my problem with the function from the file exchange.

Connectez-vous pour commenter.

 Réponse acceptée

Stephen23
Stephen23 le 4 Oct 2018
S = getframe(...)
imshow(S.cdata) % for TrueColor image (RGB).
imshow(S.cdata, S.colormap) % for indexed image.

3 commentaires

Hi stephen, I tried your method and this is what matlab showed me :
Error Too many input arguments were passed to imageDisplayParsePVPairs.
the S is in a loop so at then end of the loop I have a structure of 600 elements(1x600 frames) and I'm trying to use them all, do you know how ? and thank you for your help
Stephen23
Stephen23 le 4 Oct 2018
Modifié(e) : Stephen23 le 4 Oct 2018
@Mohamad Hussein khalife: what I showed you will work for a scalar structure, i.e. the output of one getframe call, just like my answers shows. If you have a non-scalar structure, then imshow can only be called for any one element of that structure, e.g. to show them one at a time:
for k = 1:size(S)
imshow(S(k).cdata)
... whatever processing
end
After reading the help from the FEX submission videofig, you could probably just define an anonymous function like this, where S is your non-scalar structure:
videofig(numel(S), @(n) imshow(S(n).cdata))
You should also read this, to understand the comma-separated list that you were probably generating without realizing it:
yes it worked thanks a lot

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Display Image 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!

Translated by