C# 在控制台中获取部分输出

C# 在控制台中获取部分输出,c#,.net,matlab,dll,console-application,C#,.net,Matlab,Dll,Console Application,我将matlab生成的dll文件集成到我的C#控制台应用程序中。当我运行C#console应用程序时,控制台中只显示部分输出。如何生成完整的输出?另外,我在C#控制台应用程序和matlab中的输出略有不同,原因可能是什么 matlab文件使用fprintf显示数据。我的C语言代码是 我在控制台中只得到部分输出。我的输出有点长,它由1000个数据组成,我只得到最后大约150个数据 MATLAB中的代码: tic; % for the sparse vectors, just save the n

我将matlab生成的dll文件集成到我的C#控制台应用程序中。当我运行C#console应用程序时,控制台中只显示部分输出。如何生成完整的输出?另外,我在C#控制台应用程序和matlab中的输出略有不同,原因可能是什么

matlab文件使用fprintf显示数据。我的C语言代码是

我在控制台中只得到部分输出。我的输出有点长,它由1000个数据组成,我只得到最后大约150个数据

MATLAB中的代码:

tic;

% for the sparse vectors, just save the nonzero indices and their corresponding values
ttemp = color_weight_vec_coarse(:);
[m n] = size(ttemp);
fprintf([num2str(m) ' ' num2str(n) '\n']);
nonzero_idx = find(ttemp);
fprintf([num2str(numel(nonzero_idx)) '\n']);
for x = 1:numel(nonzero_idx)
    % zero based indexing
    fprintf([num2str(nonzero_idx(x)-1) ' ' num2str(ttemp(nonzero_idx(x))) '\n']);
end

% for the sparse vectors, just save the nonzero indices and their corresponding values
ttemp = color_weight_vec_fine(:);
[m n] = size(ttemp);
fprintf([num2str(m) ' ' num2str(n) '\n']);
nonzero_idx = find(ttemp);
fprintf([num2str(numel(nonzero_idx)) '\n']);
for x = 1:numel(nonzero_idx)
    % zero based indexing
    fprintf([num2str(nonzero_idx(x)-1) ' ' num2str(ttemp(nonzero_idx(x))) '\n']);
end

ttemp = shoe_grad_pyramid_shape(:);
[m n] = size(ttemp);
fprintf([num2str(m) ' ' num2str(n) '\n']);
for x = 1:m
    for y = 1:n
        if y<n
            fprintf([num2str(ttemp(x,y)) ' ']);
        else
            fprintf([num2str(ttemp(x,y)) '\n']);
        end
    end
end

ttemp = shoe_grad_pyramid_texture(:);
[m n] = size(ttemp);
fprintf([num2str(m) ' ' num2str(n) '\n']);
for x = 1:m
    for y = 1:n
        if y<n
            fprintf([num2str(ttemp(x,y)) ' ']);
        else
            fprintf([num2str(ttemp(x,y)) '\n']);
        end
    end
end
toc;
return;
tic;
%对于稀疏向量,只需保存非零索引及其相应的值
ttemp=颜色、重量、向量、粗糙度(:);
[MN]=尺寸(ttemp);
fprintf([num2str(m)'num2str(n)'\n']);
非零_idx=查找(ttemp);
fprintf([num2str(numel(nonzero_idx))'\n']);
对于x=1:numel(非零_idx)
%零基索引
fprintf([num2str(nonzero_idx(x)-1)'num2str(ttemp(nonzero_idx(x)))'\n']);
结束
%对于稀疏向量,只需保存非零索引及其相应的值
ttemp=颜色、重量、向量、精细度(:);
[MN]=尺寸(ttemp);
fprintf([num2str(m)'num2str(n)'\n']);
非零_idx=查找(ttemp);
fprintf([num2str(numel(nonzero_idx))'\n']);
对于x=1:numel(非零_idx)
%零基索引
fprintf([num2str(nonzero_idx(x)-1)'num2str(ttemp(nonzero_idx(x)))'\n']);
结束
ttemp=鞋的形状(:);
[MN]=尺寸(ttemp);
fprintf([num2str(m)'num2str(n)'\n']);
对于x=1:m
对于y=1:n

如果没有更多的信息,任何人都很难提供帮助。也许你已经发布了到目前为止的内容。我已经给出了我的代码。我没有使用控制台。我在matlab中使用fprintf打印数据。我得到的是部分输出,你说的部分输出是什么意思?在您的代码中,它在哪里输出数据?正如我提到的,它只提供1000个输出数据中的最后150个数据。并通过MATLAB对输出进行显示。在MATLAB中,它工作得很好,但是在控制台中,我没有得到所有的输出。你能给我们看一下你输出到控制台的代码吗
tic;

% for the sparse vectors, just save the nonzero indices and their corresponding values
ttemp = color_weight_vec_coarse(:);
[m n] = size(ttemp);
fprintf([num2str(m) ' ' num2str(n) '\n']);
nonzero_idx = find(ttemp);
fprintf([num2str(numel(nonzero_idx)) '\n']);
for x = 1:numel(nonzero_idx)
    % zero based indexing
    fprintf([num2str(nonzero_idx(x)-1) ' ' num2str(ttemp(nonzero_idx(x))) '\n']);
end

% for the sparse vectors, just save the nonzero indices and their corresponding values
ttemp = color_weight_vec_fine(:);
[m n] = size(ttemp);
fprintf([num2str(m) ' ' num2str(n) '\n']);
nonzero_idx = find(ttemp);
fprintf([num2str(numel(nonzero_idx)) '\n']);
for x = 1:numel(nonzero_idx)
    % zero based indexing
    fprintf([num2str(nonzero_idx(x)-1) ' ' num2str(ttemp(nonzero_idx(x))) '\n']);
end

ttemp = shoe_grad_pyramid_shape(:);
[m n] = size(ttemp);
fprintf([num2str(m) ' ' num2str(n) '\n']);
for x = 1:m
    for y = 1:n
        if y<n
            fprintf([num2str(ttemp(x,y)) ' ']);
        else
            fprintf([num2str(ttemp(x,y)) '\n']);
        end
    end
end

ttemp = shoe_grad_pyramid_texture(:);
[m n] = size(ttemp);
fprintf([num2str(m) ' ' num2str(n) '\n']);
for x = 1:m
    for y = 1:n
        if y<n
            fprintf([num2str(ttemp(x,y)) ' ']);
        else
            fprintf([num2str(ttemp(x,y)) '\n']);
        end
    end
end
toc;
return;