C++数组读入MATLAB数据

data = rand(8, 10);
fid  = fopen('File.data', 'w');
if fid == - 1
  error('Cannot open file for writing');
end
fwrite(fid, ndims(data), 'uint16');
fwrite(fid, size(data), 'uint64');
fwrite(fid, data, 'double');
fclose(fid);
The reading from C++ is equivalent: Read the number of dimensions as uint16, then the dimension itself as uint64 and then the actual data.

猜你喜欢

转载自www.cnblogs.com/yaos/p/10497074.html