加载图像集 - Matlab-->C++ 翻译
Load set of images - Matlab-->C++ translation
我有一个Matlab脚本,我正在尝试将其转换为C++(见下文),因为它非常慢。我是一个C++新手,首先我尝试使用codegen
但它不起作用(我收到消息???此文本包含非空的顶级表达式。 它似乎是一个脚本。
您对如何开始转换代码有什么建议吗?另外,完成fitsread
工作的最佳C++功能是什么?
这是我的代码:
clear;
number_projections = 10;
imgs_per_proj = 2000; % Number of images per projection
% Lets load the reference images relative to the various wavelengths
R1 = zeros(imgs_per_proj, 512, 512);
R2 = zeros(imgs_per_proj, 512, 512);
l = 0;
for k = 1:imgs_per_proj
s = sprintf('Ref/R1_000_%05i.fits',k-1);
t = sprintf('Ref/R2_000_%05i.fits',k-1);
l = l + 1;
R1(l,:,:) = fitsread(s);
R2(l,:,:) = fitsread(t);
end
codegen
要求您尝试转换的 MATLAB 代码位于函数中,并且您似乎正在尝试转换脚本
但是,即使您这样做,fitsread
似乎也不是 codegen
中支持的功能。以下是支持的功能列表:http://www.mathworks.com/help/simulink/ug/functions-supported-for-code-generation--alphabetical-list.html
C++中没有"内置"功能可以取代fitsread
- 为此你需要一个库。有一个名为CCFits
的C++ FITS库,你可以在这里找到:http://heasarc.gsfc.nasa.gov/fitsio/CCfits/
他们应该有您可以遵循的教程。
相关文章:
- EASTL矢量<向量<int>>连续的
- C - 创建矢量&lt; vector&lt; double&gt;&gt;矩阵具有分配而不是inizializ
- C 字符串比较“祝您好运”&gt;“再见”
- 为什么将此对向量&lt; map&lt; int,int&gt;&gt;中的地图进行更新.失败
- C :对矢量进行排序&lt; struct&gt;(结构有2个整数)基于结构的整数之一
- C 操作员&gt;&gt;与突变器过载
- 明确的专业化“ CheckIntmap&lt;&gt;”实例化
- 是否需要使用 - &gt;运算符在C 中调用成员函数时
- 什么是模板&lt;&gt;inline bla bla
- 编辑C Qlist&lt; object*&gt; gt;QML代码和一些QML警告中的模型
- eigen :: llt&lt;eigen :: matrixxd&gt;具有不完整的类型
- 错误,包括&lt; ctype&gt;在原子上使用C 11
- 错误c++visual studio c2227左侧'->;Init';必须指向类/结构/联合/泛型类型
- std::vector<;uint8_t>;当C++11/14启用时,手动复制而不是调用memcpy
- ``这个''不能用this-&gt;指针变量
- 如何加入向量&lt; int&gt;到C 中的单个INT
- 是std :: set&lt; std :: future&gt;不可能存在
- 使用shared_ptr<字符串>转换为一个无序集合<字符串>
- 是numeric_limits&lt; int&gt; :: is_modulo从逻辑上矛盾
- opencv 2.4.7在iOS错误背景_segm.hpp #include&lt; list&gt;未找到