<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: How to run the C++ version for this loop</title>
		<link>http://www.k-wave.org/forum/topic/how-to-run-the-c-version-for-this-loop</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 22:32:40 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/how-to-run-the-c-version-for-this-loop" rel="self" type="application/rss+xml" />

		<item>
			<title>pamparana on "How to run the C++ version for this loop"</title>
			<link>http://www.k-wave.org/forum/topic/how-to-run-the-c-version-for-this-loop#post-9033</link>
			<pubDate>Tue, 06 Feb 2024 21:56:50 +0000</pubDate>
			<dc:creator>pamparana</dc:creator>
			<guid isPermaLink="false">9033@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;I am trying to port the diagnostic US example and trying to run this using the C++ code. Considering following matlab loop:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;% loop through the scan lines
for scan_line_index = 1:number_scan_lines

    % load the current section of the medium
    medium.sound_speed = sound_speed_map(:, medium_position:medium_position + Ny - 1, :);
    medium.density = density_map(:, medium_position:medium_position + Ny - 1, :);

    % run the simulation
    sensor_data = kspaceFirstOrder3D(kgrid, medium, transducer, transducer, input_args{:});

    % extract the scan line from the sensor data
    scan_lines(scan_line_index, :) = transducer.scan_line(sensor_data);

    % update medium position
    medium_position = medium_position + transducer.element_width;

end&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;If I understand correctly, if I need to move this to C++, I should basically create HD5 input file for every call to &#60;code&#62;kspaceFirstOrder3D&#60;/code&#62; and them call the C++ application with that input file. So, is it correct that if I want to reproduce this example, I need to create &#60;code&#62;number_scan_lines&#60;/code&#62; HD5 input files and then call the C++ program on each of them?&#60;/p&#62;
&#60;p&#62;Assuming this is correct, the next matlab line in the example is:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;scan_lines(scan_line_index, :) = transducer.scan_line(sensor_data);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;How do I then create the scan lines array from the C++ outputs?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
