Can I insert a new generated GIF into my live script - matlab

Matlab live script
the script generates a new .gif
I want to show the new .gif in the script
I know it is possible to insert it at the beginning, but how do I do at runtime?
Code: (solution with video player is no option)
filename = 'animatedPicture.gif';
animatedPicture is created
imshow(animatedPicture.gif) % would only show one frame

Related

Use windows snip and sketch clipboard temp image in cmd

So i'm trying to use the current clipboard file when using snip and sketch in windows 10 in a imagemagick .bat process which converts them to icons, it seems to save to the directy,
AppData\Local\Packages\Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy\TempState\ScreenClip
But its 3 files,a .json,thumbnail, and then the actual picture. The two pngs dont have any way to differenciate themselves, the file sizes and time made and resolution and name all seem to be random so i cant pull them from that folder, it also seems to save every single snip ever so its a big mess.
Part of the problem i think is that it doesnt appear in the paste clipboard even tho it does exist somewhere because you can paste directly into word docs or discord and it recognises it.
The other thing i've tried is getting the paste.exe from c3scripts.com which only seems to work with text outputting to a .txt file.
I've tried powershell using Get-Clipboard command, which also only works with text.
Does anyone know how to pull this file from the clipboard into something usable in cmd so i can add it to the .bat or if theres another program enterierly that could snip the screen more efficinetly.
TLDR: need way to crop and screencap and save file with least amount of steps possible
you can use Get-clipboard's -format switch in Powershell:
# Verify if clipboard has image and if it has then save it
Add-Type -AssemblyName System.Windows.Forms
$clipboard = [System.Windows.Forms.Clipboard]::GetDataObject()
if ($clipboard.ContainsImage()) {
$img = get-clipboard -format image
$img.save("FilePath")
}

How to get high quality image into word document

Manually a figure can be saved as svg file, but I cannot import it properly in word document. Is there other way around?
As Cirs Luengo says, you could copy (Edit -> Copy Figure) and paste the figure form MATLAB into Word, but to ensure the picture is saved as vector-graphics you have to check your settings in Preferences->Figure Copy Template->Copy Options.

How to delete a file in imageJ macro

I am trying to write a macro so in imageJ. I want to apply this macro to different image file.
So in the beginning, I save the selected picture with temp.jpg file name
saveAs("Jpeg", "/Users/pathreskoo/Desktop/IHC/temp.jpg");
After I finish the process, I want to delete the file
I try
ok = file.delete("/Users/pathreskoo/Desktop/IHC/temp.jpg");
But the file was not removed. What should I do?
ImageJ macro is case sensitive. Try using File.delete, not file.delete.
https://imagej.nih.gov/ij/developer/macro/functions.html#File.delete

How to change Excel 2013 Template Miniature

Is there a simple way to change / replace the automatically generated Template Miniature with a different image.
I have checked this out for Excel 2016 but the process is similar.
First, the thumbnail is generated and part of the file. There is no official process. A description for brave Office pros is shown below.
You can do this:
First, close Excel!
Get to the location of your template
Make a copy
Rename the file extension to .zip
Unzip the file into a new folder using the Windows Zip utility
Search the tree of files for a file called thumbnail.wmf
Open PowerPoint and create an empty presentation
Use the function "Insert an Image" and add the thumbnail.wmf to the slide
Remove everything else from the slide
Try to ungroup - it fails with a message asking to convert to a drawing object
From here you have two options. Either convert, ungroup, change and proceed or throw away and create a new image from scratch.
Work on image and group your image (the old or a new one), then
Right click on the grouped image and click "Save as picture"
Choose the filetype "wmf" and name it the same as before and overwrite the existing thumbnail.wmf
Go INTO the folder using Windows Explorer of unpacked files, hit Ctrl-A (Select All)
Right click and say "Send to" --> "Compressed (zipped) folder". Give it a new name.
Hit F2 to rename the file
Remove the file extension .zip
Now, open Excel!
Hit "New", "Personal" and you see your template with your custom image in full width and height. Repeat steps 10 to 16 until you're satisfied.
Drawbacks: Once you edit your file in excel and save as template with thumbnails option (advanced properties) switched on, Excel will overwrite your custom wmf-file. You have to repeat the steps "Unpack -> Replace File -> Pack" every time.
I'll post an update once I found a better solution.
Here is an automation of the process that might help with understanding the process described in the answer.
Python 3 code snippet
import zipfile
import shutil
exfilename = 'MYTEMPLATE.xltm'
a_path='C:\\TEMP'
th_path='mythumbnail.wmf'
with zipfile.ZipFile (exfilename, 'r') as zf:
#Extract to temporary folder
zf.extractall(a_path)
#replace the thumbnail
shutil.copyfile(th_path,a_path+'\\docProps\\thumbnail.wmf')
#remake the zip as a new file
shutil.make_archive('TEMP_ARCHIVE','zip',a_path)
#rename back to original, replacing original
shutil.move('TEMP_ARCHIVE.zip',exfilename)
#clean-up temporary files
shutil.rmtree(a_path)

MATLAB GUI set default values

I am working on a GUIDE in Matlab and I have to constantly change a couple of Edit Text values.
I have realized that if I change the String value of an Edit Text from the property inspector in the .fig file it sticks there when I run the code even if I close Matlab and reopen it, so I suppose that it is stored somewhere. I would like to know if there is a way of changing those 'default' values while running the gui.
I want to add a pushbutton to set the displayed data as default, so it is kept for the next time I run the code.
Thanks very much in advance!
Not sure if there is a more elegant way, but you can do the following as a workaround:
Once the button is clicked
Create a file
Write new default values instead of older ones
At the start of GUI
Open the file
Get the default values
Set the default values on GUI