当前位置:网站首页>MATLAB输出格式控制 %d,%f,%c,%s的用法
MATLAB输出格式控制 %d,%f,%c,%s的用法
2022-06-29 15:48:00 【Dust_Evc】
1. %d输出整型;
%4d就是说输出总长度最小为4,比如110,输出就是“_110”,“_”代表空格。如果为110110,输出也为110110
2. %f输出小数;
%4.2f表示输出总长度最小为4,小数点后保留2位。如果小数点前总长度大于这里的4,则也会输出完整、正确的值,如果小数点前+小数点后2位总长小于4,则会在前面加空格。
例子:
>> a = 123456.246
a =
123456.246
>> A_pathout = sprintf('wd_%5.1f', a)
A_pathout =
'wd_123456.2'
>> A_pathout = sprintf('wd_%1.1f', a)
A_pathout =
'wd_123456.2'
>> A_pathout = sprintf('wd_%10.1f', a)
A_pathout =
'wd_ 123456.2' %% 注:前面2个空格3. %c输出字符串;
4. %s输出字符串;
边栏推荐
- 如何在网站上安装 WordPress
- CVPR 2022 | greatly reduce the manual annotation required for zero sample learning. Mapuosuo and Beiyou proposed category semantic embedding rich in visual information
- Magento 和 WordPress 的区别
- 教程|fNIRS数据处理工具包Homer2下载与安装
- Science: the interrelated causes and consequences of sleep in the brain
- Blue bridge cup several full array questions
- Key sprite fighting monsters - multi window and multi thread background skills
- 面试官:说一下MySQL事务隔离级别?
- 元数据管理Apache Atlas编译集成部署及测试
- UWB精准定位方案,厘米级高精度技术应用,智能配对感应技术
猜你喜欢

three. JS and Gaode map are combined to introduce obj format model - effect demonstration

Timecho of Tianmou technology completed Angel round financing of nearly RMB 100 million and built the original time series database of the industrial Internet of things around Apache iotdb

防范企业数据泄露,就用网络安全产品堡垒机!

Digital tracking analysis of insurance services in the first quarter of 2022

MySQL XA distributed transaction

天谋科技 Timecho 完成近亿元人民币天使轮融资,围绕 Apache IoTDB 打造工业物联网原生时序数据库

华夏基金:基金行业数字化转型实践成果分享

Cerebral Cortex:从任务态和静息态脑功能连接预测儿童数学技能

Cerebral cortex: predicting children's mathematical skills from task state and resting state brain function connections

Huawei cloud AOM version 2.0 release
随机推荐
CVPR 2022 | 大幅减少零样本学习所需的人工标注,马普所和北邮提出富含视觉信息的类别语义嵌入
[try to hack] upload labs (temporarily write to 12)
BOE: with the arrival of the peak season in the second half of the year, the promotion and the release of new products, the demand is expected to improve
Cortical traceability analysis of ERP
[rust daily] rust 2021 stability
加速智能驾驶项目落地?你还缺一套真值测评系统
Science: the interrelated causes and consequences of sleep in the brain
作为开发人员,无代码开发平台 iVX 你有必要了解一下
【大家的项目】 Rbatis ORM官网上线
It is expected to significantly improve the computational performance of integrated photonic circuits. The Tsinghua team proposed a diffraction pattern neural network framework
golang gopsutil库的使用:进程和系统资源监控(CPU 内存 磁盘等)
路由汇总带来的三层环路-解决实验
MySQL XA distributed transaction
Blue bridge cup several full array questions
When easygbs calls the interface for obtaining real-time snapshots, how to solve the problem of white squares?
How to create a login page in WordPress
Alipay "security lock" was selected as an excellent case in the "child care program" of the ICT Institute: more than 330000 users have opened game protection
等保测评结论为差,是不是表示等保工作白做了?
Summary of common MySQL statements and commands
关于 麒麟系统启动应用报错“undefined symbol: __cxa_throw_bad_array_new_length, version Qt_5“ 的解决方法