java读写excel

java应用jxl API读写excel:

package tf.excel;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import jxl.Cell;
import jxl.CellType;
import jxl.DateCell;
import jxl.LabelCell;
import jxl.NumberCell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.CellFormat;
import jxl.format.Colour;
import jxl.format.VerticalAlignment;
import jxl.write.DateFormats;
import jxl.write.DateTime;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import common.Logger;

public class JxlTest {

	private static Logger log = Logger.getLogger(JxlTest.class);

	private static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");

	private File file;

	public JxlTest(String fileName) {
		this.file = new File(fileName);
	}

	public JxlTest(File file) {
		this.file = file;
	}

	public static void main(String[] args) {
		JxlTest jxl = new JxlTest("users.xls");
		jxl.writeExcel();

		List<User> list = jxl.readExcel();
		for (User u : list) {
			log.info(u.yhm + "--" + u.xm + "--" + u.age + "--"
					+ df.format(u.sr));
		}
	}

	public void writeExcel() {
		WritableWorkbook ww;
		try {
			ww = Workbook.createWorkbook(file);
			WritableSheet ws = ww.createSheet("用户信息", 0);

			Operate.addLabelToSheet(ws, 0, 0, 3, 0, "用户信息", Style
					.getHeaderStyle());
			Operate.addLabelToSheet(ws, 0, 1, "用户名", Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 1, 1, "姓名", Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 2, 1, "年龄", Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 3, 1, "生日", Style.getTitleStyle());

			Operate.addLabelToSheet(ws, 0, 2, "tt", Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 1, 2, "糖糖", Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 2, 2, 25, Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 3, 2, df.parse("1984-08-12"), Style
					.getDateStyle());
			Operate.addLabelToSheet(ws, 0, 3, "ff", Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 1, 3, "飞飞", Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 2, 3, 24, Style.getTitleStyle());
			Operate.addLabelToSheet(ws, 3, 3, df.parse("1985-11-25"), Style
					.getDateStyle());

			for (int i = 0; i < 4; i++) {
				ws.setColumnView(i, 16);
			}
			ws.setRowView(0, 20);
			ww.write();
			ww.close();
			log.info("写入excel成功!");
		} catch (Exception e) {
			log.info("写入excel失败!");
			e.printStackTrace();
		}

	}

	public List<User> readExcel() {
		List<User> list = new ArrayList<User>();
		Workbook wb;
		try {
			wb = Workbook.getWorkbook(file);

			Sheet sheet = wb.getSheet(0);
			int row = sheet.getRows();
			int col = sheet.getColumns();
			for (int i = 2; i < row; i++) {
				User user = new User();
				for (int j = 0; j < col; j++) {
					Cell cell = sheet.getCell(j, i);

					if (cell.getType() == CellType.LABEL) {
						LabelCell lc = (LabelCell) cell;
						switch (j) {
						case 0:
							user.setYhm(lc.getContents());
						case 1:
							user.setXm(lc.getContents());
						}
					}

					if (cell.getType() == CellType.NUMBER) {
						NumberCell nc = (NumberCell) cell;
						user.setAge((int) nc.getValue());
					}

					if (cell.getType() == CellType.DATE) {
						DateCell dc = (DateCell) cell;
						user.setSr(dc.getDate());
					}
				}
				list.add(user);
			}
			log.info("读取excel成功!");
		} catch (Exception e) {
			log.info("读取excel失敗!");
			e.printStackTrace();
		}
		return list;

	}

	static class Style {
		/**
		 * 页头样式
		 */
		public static WritableCellFormat getHeaderStyle() throws Exception {
			WritableFont font = new WritableFont(WritableFont.TIMES, 14); // 设置14号字体
			font.setColour(Colour.BLUE); // 设置字体颜色
			font.setBoldStyle(WritableFont.BOLD); // 设置粗体字
			WritableCellFormat format = new WritableCellFormat(font); // 设置单元格样式
			format.setBackground(Colour.LIGHT_GREEN); // 设置背景颜色
			format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);//设置边界样式
			format.setAlignment(Alignment.CENTRE); // 设置水平位置
			format.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置竖直位置
			return format;
		}

		/**
		 * 标题样式
		 */
		public static WritableCellFormat getTitleStyle() throws Exception {
			WritableFont font = new WritableFont(WritableFont.TIMES, 14);
			font.setColour(Colour.GREEN);
			WritableCellFormat format = new WritableCellFormat(font);
			format.setBackground(Colour.VERY_LIGHT_YELLOW);
			format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
			format.setAlignment(Alignment.CENTRE);
			format.setVerticalAlignment(VerticalAlignment.CENTRE);
			return format;
		}

		/**
		 * 内容样式
		 */
		public static WritableCellFormat getContentStyle() throws Exception {
			WritableFont font = new WritableFont(WritableFont.TIMES, 14);
			font.setColour(Colour.BLUE);
			WritableCellFormat format = new WritableCellFormat(font);
			format.setBackground(Colour.VERY_LIGHT_YELLOW);
			format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
			format.setAlignment(Alignment.CENTRE);
			format.setVerticalAlignment(VerticalAlignment.CENTRE);
			return format;
		}

		/**
		 * 普通样式
		 */
		public static WritableCellFormat getNormalStyle() throws Exception {
			WritableFont font = new WritableFont(WritableFont.TIMES, 14);
			font.setColour(Colour.BLUE);
			WritableCellFormat format = new WritableCellFormat(
					DateFormats.FORMAT12);
			format.setBackground(Colour.VERY_LIGHT_YELLOW);
			format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
			format.setAlignment(Alignment.CENTRE);
			format.setVerticalAlignment(VerticalAlignment.CENTRE);
			return format;
		}

		/**
		 * 日期样式
		 */
		public static WritableCellFormat getDateStyle() throws Exception {
			WritableFont font = new WritableFont(WritableFont.TIMES, 14);
			font.setColour(Colour.BLUE);
			WritableCellFormat format = new WritableCellFormat(
					DateFormats.FORMAT1);
			format.setBackground(Colour.VERY_LIGHT_YELLOW);
			format.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
			format.setAlignment(Alignment.CENTRE);
			format.setVerticalAlignment(VerticalAlignment.CENTRE);
			return format;
		}
	}

	static class Operate {
		/**
		 * 写入文本
		 */
		public static void addLabelToSheet(WritableSheet ws, int col, int row,
				String cont, CellFormat format) throws Exception {
			Label label = new Label(col, row, cont, format);
			ws.addCell(label);
		}

		/**
		 * 写入文本(合并后的单元格)
		 */
		public static void addLabelToSheet(WritableSheet ws, int firstCol,
				int firstRow, int lastCol, int lastRow, String cont,
				CellFormat format) throws Exception {
			ws.mergeCells(firstCol, firstRow, lastCol, lastRow);
			addLabelToSheet(ws, firstCol, firstRow, cont, format);
		}

		/**
		 * 写入数字
		 */
		public static void addLabelToSheet(WritableSheet ws, int col, int row,
				double num, CellFormat format) throws Exception {
			jxl.write.Number number = new jxl.write.Number(col, row, num,
					format);
			ws.addCell(number);
		}

		/**
		 * 写入日期
		 */
		public static void addLabelToSheet(WritableSheet ws, int col, int row,
				Date date, CellFormat format) throws Exception {

			DateTime dt = new DateTime(col, row, date, format, DateTime.GMT);
			ws.addCell(dt);
		}
	}

	static class User {
		private String yhm;
		private String xm;
		private int age;
		private Date sr;

		public String getYhm() {
			return yhm;
		}

		public void setYhm(String yhm) {
			this.yhm = yhm;
		}

		public String getXm() {
			return xm;
		}

		public void setXm(String xm) {
			this.xm = xm;
		}

		public int getAge() {
			return age;
		}

		public void setAge(int age) {
			this.age = age;
		}

		public Date getSr() {
			return sr;
		}

		public void setSr(Date sr) {
			this.sr = sr;
		}
	}
}

 

Java操作Excel之POI:java读写excel文件以及打印设置 Java操作Excel之POI:java读写excel文件以及打印设置 POI的jar包下载地址:http://poi.apache.org/download.html 注意:项目中导入poi 4.0.1的jar包,其他版本不确保没有错误。 HSSFCellStyle.VERTICAL_CENTER没有定义的解决办法参考https://blog.youkuaiyun.com/weixin_43209201/... 阅读详情

相关推荐

Java读写Excel 表格

开源社区已经创造了许多开源Java项目,从制表软件到游戏框架到文字处理。在这篇文章中,我介绍一个可以读写微软Excel电子表格的开源类库项目。 推荐一个电子表格类库 问题:我以前被要求去扩展我们公司的以Java为基础的电子表格软件,实现读写Excel电子表格的功能。你能推荐给我一个可以帮助我完成这个任务的开源Java类库吗? 回答:你可以考虑一下JExcelAPI,它是一个成熟的

一蓑烟雨任平生 1547

java 读写 excel_Java 读写 Excel

目前主要有两种常用的方式,jxl和POI。因为POI功能更加强大,面对大量数据时操作性能更加优于jxl,因此,在工作中一般使用POI来操作excel。POI是Apache下的开放源码函数库,POI提供了一系列的api来供java程序员对Microsoft Office格式的文档提供读写功能。本片中就用POI模式进行举例:首先工具类,读写Excel的类,Excelutil1代码如下,代码基本上都是从...

weixin_33139275的博客 320

Windows Server 2012评估版过期自动关机问题:两种高效解决方案详解

本文针对Windows Server 2012评估版过期导致的自动关机问题,提供了两种高效解决方案。一是通过slmgr.vbs命令重置授权,临时延长评估期;二是使用DISM工具将评估版转换为正式版,一劳永逸。文章详细解析了两种方法的操作步骤、注意事项及适用场景,帮助用户快速恢复服务器稳定运行。

pytorchlight8的博客 1197

使用Java代码(POI)读写 Excel

使用Java代码(POI)读写 Excel,这篇博客给出了实现逻辑并有完整的代码实现。

扬帆向海的博客 4万+

COMSOL报错调试总结(不定期更新)

COMSOL报错调试总结1. 可定位错误1.1 除零错误1.2 未定义变量值1.3 边界条件/材料属性等缺失2. 难定位错误2.1. 装配期间内存不足 官方给的案例总是非常完美,运行流畅,结果完美。但是自己做模型时候就总是报错,而且不像自己coding的程序那样可以明确定位哪里出了bug。这里把我碰到的一些报错问题以及调试方法记录下来~ 部分来源于以下参考来源: http://wap.sciencenet.cn/blog-1467490-1118453.html?mobile=1 1. 可定位错误 以下错误

jessica0307的博客 8万+

智能问数系统的完整技术栈与实现逻辑

提取并增强数据库 Schema(含业务语义)选择 LLM(开源 qwen2 / 商业 GPT-4o)构建 RAG 向量库(存储历史问法)实现 SQL 安全校验与权限控制添加结果自然语言解释 + 可视化部署到只读数据库环境🔑核心原则“先保证安全,再追求智能”—— 一个能生成错误 SQL 的智能问数系统,比没有更危险。

我们的征途是星辰大海 1629

JAVA 实现读写excel文件

JAVA 实现读写excel文件 大家好,我是梦辛工作室的灵,最近在一个批量录入数据的 工具,顺便做了一下封装,可以更好的使用: 使用方法如下: import java.io.File; import java.util.List; public class Test { public static void main(String[] args) { printExcel("C:\\Users\\Administrator\\Desktop\\test.xls"); } public

灵神翁的博客 3163

spring-ai 1.0.0 学习(四)——提示词管理

摘要:本文介绍Spring AI中提示词管理的最佳实践。首先展示基础样例,指出直接传递用户输入的局限性。随后分析优质提示词应包含系统消息、上下文信息、输出结构和问答样例四要素。文章详述两种实现方式:链式调用(使用ChatClient构建器)和传统对象创建方法。进阶部分涵盖核心接口(Prompt、Message等)、消息类型、模板渲染配置(支持自定义)及提示词工程技巧(如RAG、任务分解)。最后提及高级功能如少样本模板和提示词库。全文强调结构化提示词对提升AI输出质量的关键作用,并展示Spring AI的灵活

hzp的专栏 1365

Java使用EasyExcel实现对excel文件的读写

Java使用EasyExcel实现对excel文件的读写

lfyyyyy的博客 2644

告别‘小爱同学’:用ESP32-S3和esp-sr SDK,从零打造一个离线语音助手(含完整代码)

本文详细介绍了如何利用ESP32-S3芯片和esp-sr SDK从零构建一个离线语音助手,涵盖硬件选型、声学设计、SDK配置及低功耗优化等关键步骤。通过实战案例和完整代码,帮助开发者实现自定义唤醒词和命令词,打造低成本、高隐私的本地语音控制解决方案。

weixin_29041195的博客 371

华为OD机试真题 新系统 2026-08-02 C++ 实现【战士技能规划设计】

你为一款动作游戏设计战士角色的技能。战士每个技能会消耗不同能量,释放技能有两个约束:连续释放技能数量不能超过 m 个,技能能量总和不能超过能量上限 k;如果超过则必须中断当前技能,进入调息状态,也就是分段。

MISAYAONE的博客 76

java读写Excel

java读写Excel现在客户对数据格式的要求越来越高了,前段时间要求在后台直接生成Excel,以后还会不会要求在后台读写word?pdf? 我想这种需求肯定会来的 不说这些了,读写Excel的开源包不少,Apach的POI,JExcel......不过我看上一款Jxl,这个包是韩国的程序员封装的,操作起来比较方便,上手也很快,拿出来给大家分享一下 Jxl.jar包在网上很

5602

十七、SAP-采购订单(STO)

业务逻辑、功能讲解、图文解析、章节总结

m0_72403327的博客 2068

用java读写excel

package com.atguigu.lambda1; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException;在这里插入代码片 import java.io.InputStream; impo...

qq_40068279的博客 162

RK3588芯片USB OTG模式切换:Device到Host的驱动奥秘之旅

摘要:本文详细介绍了RK3588芯片USB OTG模式从Device到Host的完整驱动流程,包括硬件电路设计、内核驱动配置、模式切换机制及验证方法。RK3588芯片凭借强大的性能和灵活的USB OTG特性,在工业控制、智能家居等领域具有广泛应用前景。文章重点分析了Type-C接口设计、USBPHY芯片选型、Linux内核模块配置等关键技术要点,并提供了模式切换脚本使用方法和常见问题解决方案,为开发者实现RK3588 USB OTG功能提供了全面指导。

远程部署调试 运行安装 项目调试 二次开发 项目技术新 持续迭代 部分源码免费分享 743

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

java poi excel读写_Java使用POI实现对Excel文件的读写

Apache POI提供了Java程序读取和写入MS Office文档的接口。对于Excel文档读写:-HSSF:提供读写MS Excel的xls文件的功能。-XSSF:提供读写MS Excel的xlsx文件的功能。Java使用POI实现对Excel文件的读写操作本篇的ExcelUtils工具类,主要针对于一行数据(row)作为一个实例(t)的情况使用。Excel对象Java对象表格(sheet)...

weixin_39807352的博客 256

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

java excel 读写_Java读写Excel表格

/**@文件名:JxlWriteDemo.java*@创建时间:2020年5月25日下午11:26:50*@作者:Fang*@注释:*/packageFang.five;importjava.io.File;importjava.io.IOException;importjxl.Sheet;importjxl.Workbook;importjxl.read.biff.BiffExcep...

weixin_33669545的博客 119

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

【Java实现 通过Easy Excel完成对excel文本数据的读写】

Java实现 通过Easy Excel完成对excel文本数据的读写,解决POI处理大文件内存溢出

高克莱的博客 1539

Java读写Excel

1.引入POI依赖 2. package com.cowcow.poi; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apa...

JokerBlue的专栏 748

java 同时读写excel文件_java poi对同一个excel文件进行读写

环境操作系统:win7jdk: 1.7需求1、产品部的同事经常给我一批账号,然后去统计这些账号的登录次数。他们一般给我这样的一份文件: ①我一般的做法就是先把这个账号全部读出来,用set集合装好后,再去统计登录次数。②把统计好的结果导出到新的excel中。关键上面第二步,产品部的人,不得不手动的重复复制粘贴操作。时间长了,他们就有意见啦。改进以前我总是导出到新的excel中,是因为我不知道怎么对同...

weixin_35831315的博客 617

JAVA Excel读写

pom 依赖 <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.16</version> </dependency> <dependency...

大数据开发 552

读写excel java_Java实现excel简单读写

概述Apache POI是 Java 程序员用来处理 MS Office 文件的常用开源库。由 Apache 软件基金会开发,使用 Java 分布式设计或修改 Microsoft Office 文件,包含一系列类和方法对用户输入数据或文件进行编码和解码。其中 POI-HSSF 和 POI-XSSF 是用来处理 excel 文件的组件,前者对应 97~2007版本的文件格式(.xls), 后者对应0...

weixin_39711959的博客 101

JAVA POI读写excel

JAVA利用POI读取和导出EXCEL操作。

yongchao71 1112

Java用XSSFWorkbook实现excel简单读写

一起来学习如何用Java实现excel简单读写 Java用XSSFWorkbook实现excel简单读写一、概述二、所需的jar三、XSSFWorkbook的使用方法四、源代码 一、概述 Apache POI是 Java 程序员用来处理 MS Office 文件的常用开源库。由 Apache 软件基金会开发,使用 Java 分布式设计或修改 Microsoft Office 文件,包含一系列类和方...

qq_34294187的博客 5634

java使用 POI读写excel文档

目录结构一. Poi介绍1. 简介2. 使用前提3. 优劣势4. Poi包结构二. poi入门案例1.从 Excel 文件读取数据2.向 Excel 文件写入数据三. 实战训练0.环境准备1. 读取excel 数据到数据库2. 将数据库中文件写入到excel3. 增加样式四. 总结 一. Poi介绍 1. 简介 是由 Apache公司提供的。 Java编写的免费开源的跨平台Java API 提...

林仔520的博客 908
上一篇: java堆栈应用之括号匹配
下一篇: Oracle函数大全
reallyafei
博客等级 码龄20年 7粉丝 12原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值