save

Save Matlab figure without plotting it?

瘦欲@ 提交于 2019-12-05 18:30:00
问题 Is there a way of saving a figure plot without actually plotting it? I mean, let's say I want to save the graph for plot(1:10, (1:10).^2) , can I save it without showing it? I want to make the run time shorter by cutting off the unnecessary plotting of the figures (those will be closed anyway after saving). Thanks! 回答1: This can be done: set(gcf,'Visible','off'); plot((1:10),(1:10).^2); print -dpng c:\chris.png % or whatever your print command is 回答2: There is also the saveas(h,'filename.ext'

How to append a variable to a .mat file?

▼魔方 西西 提交于 2019-12-05 18:25:47
If I already have a .mat file with the variables x and y , is there a way to use the save command to add another variable z to the .mat file without having to explicitly state the variables x and y in the save command? If you look at the save() function documentation , there is a form of the save command that might help: save(filename, ..., '-append') The help for this form says: save(filename, ..., '-append') adds new variables to an existing file. You can specify the '-append' option with additional inputs such as variables, '-struct' , format, or version. From the manual page : save

Saving an edittext to bitmap

╄→尐↘猪︶ㄣ 提交于 2019-12-05 16:53:11
I am saving my layout to a bitmap, which contains an ImageView and an EditText. I am using this code: public void saveToImage(RelativeLayout content){ Bitmap bitmap = Bitmap.createBitmap(content.getWidth(), content.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(bitmap); content.layout(0, 0, content.getLayoutParams().width, content.getLayoutParams().height); content.draw(c); try{ File file,f = null; if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) { file =new File(android.os.Environment.getExternalStorageDirectory(),"TTImages_cache

Hibernate 4: One class mapping Two tables - How to persist one object on both tables?

半城伤御伤魂 提交于 2019-12-05 16:49:59
I have this class Person mapping two tables: Persons and PersonsAUD (audit): <class catalog="test" name="test.Person" table="Persons" entity-name="Person"> <id name="id" type="int"> <column name="Id"/> <generator class="increment"/> </id> <property name="name" type="string"> <column length="30" name="Name" not-null="true"/> </property> ... </class> <class catalog="test" name="test.Person" table="PersonsAUD" entity-name="PersonAUD"> <id name="idAudit" type="int"> <column name="IdAudit"/> <generator class="increment"/> </id> <property name="name" type="string"> <column length="30" name="Name"

Android - Save ImageView to file with full resolution image

ⅰ亾dé卋堺 提交于 2019-12-05 16:37:15
I put an image inside an ImageView and have multitouch implemented to resize and move the image inside the ImageView. Now I need to save the resized image to a image file. I have tried the .getDrawingCache() but that image have the size of the ImageView. I want the image to show what the ImageView shows but with full resolution (larger than the ImageView). Any ideas? You could hold a Bitmap Object in Background, which you can resize with this piece of code: Matrix matrix = new Matrix(); matrix.postScale(scaledWidth, scaledHeight); Bitmap resizedBitmap = Bitmap.createBitmap(originalBitmap, 0, 0

Android - Why my saved image is not appearing in the default gallery of my phone?

跟風遠走 提交于 2019-12-05 16:36:36
I am trying to save an image from my application to the default gallery of my phone. The code below works perfectly if I have a SD card on the phone. The image saved appears in the phone's gallery and everything, as expected: private Uri saveMediaEntry(File f, String title, String description, int orientation, Location loc) { ContentValues v = new ContentValues(); v.put(Images.Media.TITLE, title); v.put(Images.Media.DISPLAY_NAME, title); v.put(Images.Media.DESCRIPTION, description); v.put(Images.Media.ORIENTATION, orientation); String nameFile = f.getName(); File parent = f.getParentFile() ;

Saving large images - Raster problem

邮差的信 提交于 2019-12-05 15:38:10
I already asked a Question how to save large images and I think I'm on the right track but I still need some advice. I have an Image 12000 x 12000 and I need to save it as .png BufferedImage can't be used. I was already advised to use the RenderedImage interface but somehow I can't get the desired result. ( I haven't worked with rasters yet so probably I got something wrong ) Code for the saving image method: public static void SavePanel() { PanelImage IMAGE = new PanelImage(panel); try { ImageIO.write(IMAGE, "png", new File(ProjectNameTxt.getText() + ".png")); } catch (IOException e) { } }

Add curly braces to ggplot2 and then use ggsave

久未见 提交于 2019-12-05 15:17:25
问题 So this is very relevant to this question and this answer is an excellent solution. The problem is that when I try to export the plot using ggsave the curly braces aren't present. example: library(ggplot2) library(grid) library(pBrackets) x <- c(runif(10),runif(10)+2) y <- c(runif(10),runif(10)+2) the_plot <- qplot(x=x,y=y) + scale_x_continuous("",breaks=c(.5,2.5),labels=c("Low types","High types") ) + theme(axis.ticks = element_blank(), axis.ticks.length = unit(.85, "cm")) the_plot grid

iOS: dispatch_async and UIImageWriteToSavedPhotosAlbum

穿精又带淫゛_ 提交于 2019-12-05 15:04:47
Just learning how to allocate tasks among threads, or dispatch asynchronously. I understand that any operation that "touches" a view must be done on the main thread. What about: UIImageWriteToSavedPhotosAlbum ? I would assume this could be done on a background thread, but am I mistaken? Also, if it should be done on a background thread, is there a difference between these two calls below, as one saves a UIImage and the other saves a UIImage from a view? UIImageWriteToSavedPhotosAlbum(_someUIImage ,nil,nil,nil); UIImageWriteToSavedPhotosAlbum(_imageView.image ,nil,nil,nil); By the way I am

Save JTextArea text to a txt file

て烟熏妆下的殇ゞ 提交于 2019-12-05 14:48:26
I'm having trouble saving text from a JTextArea to a text file. When I save the data my text file has nothing in it. I feel like I'm writing to the output wrong. Is there a better way to code this? Thanks for the help! The class for the program import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.io.*; public class SaveClass extends JPanel { JPanel cards; private JPanel card1; private JTextArea textarea1; private JFileChooser fc; public SaveClass() { Font mono = new Font("Monospaced", Font.PLAIN, 12); textarea1 = new JTextArea(); textarea1.setFont(mono); card1 = new