matlab 读取文件(mat)存储为json文件
2024-08-27 08:17:57
fid= fopen('reqJosn.json', 'w+');
load('request-set-10.mat');
requests = requests.request;
requestNum = length(requests);
for i = :
request.name = sprintf('%s%d', 'vn_test_',i);
request.type = ;
request.description = sprintf('%s%d%s', 'virtual network ',i, ' for test use');
controller.id = i;
controller.name = 'defaultController';
controller.host = 'localhost';
controller.port = ;
controller.type = 'POX';
request.controller = controller;
nodeNum = requests(,i).node_num;
linkNum = requests(,i).link_num;
request.sw_number = nodeNum;
switches = {};//注意此处如需在结构里嵌套结构,必须这样子
for j = :nodeNum
swTemp.id = j;
swTemp.name = sprintf('%s%d', 'sw', j);
swTemp.resource = requests(,i).cpu(j);
swTemp.port_num = ;
swTemp.host_num = ;
switches = [switches,swTemp];
end
request.switches = switches;
subJson = savejson('',request);//幻化为json字符串,具体help一下
fprintf(fid, '%s',subJson);
end
fclose(fid);
最新文章
- 数据库分库分表(sharding)系列(一) 拆分规则
- Linux命令之dos2unix
- OpenStack虚拟机状态
- Thinkphp 使用gmail发送邮件
- LeetCode Database题解
- 【Spring源码分析系列】ApplicationContext 相关接口架构分析
- [APIO2007] 风铃
- python 用文本来提供输入信息的模板,不用每次都手动粘贴了
- mysql函数之截取字符串
- webservice-整理
- 接口自动化 基于python实现的http+json协议接口自动化测试框架源码(实用改进版)
- android画板笔锋实现
- Centos 6.5 yum 安装Apache软件
- 资料整理,SQL Server ,面试前复习笔记
- Hadoop系列-MapReduce基础
- 模板引擎 引自 《PHP核心技术与最佳实践》
- python面向对象之类成员修饰符
- 0329--Scrum团队准备工作
- JS小案例(基础好烦恼少)----持续更新
- 《梦断代码Dreaming In Code》阅读笔记(一)