<?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: Unrecognized function castZeros in kspaceFirstOrder_createStorageVariables.m</title>
		<link>http://www.k-wave.org/forum/topic/unrecognized-function-castzeros-in-kspacefirstorder_createstoragevariablesm</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:28:16 +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/unrecognized-function-castzeros-in-kspacefirstorder_createstoragevariablesm" rel="self" type="application/rss+xml" />

		<item>
			<title>bob2024 on "Unrecognized function castZeros in kspaceFirstOrder_createStorageVariables.m"</title>
			<link>http://www.k-wave.org/forum/topic/unrecognized-function-castzeros-in-kspacefirstorder_createstoragevariablesm#post-9141</link>
			<pubDate>Sun, 08 Sep 2024 17:59:16 +0000</pubDate>
			<dc:creator>bob2024</dc:creator>
			<guid isPermaLink="false">9141@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Sorry, my bad. The function is actually defined in kspaceFirstOrder_inputChecking.m&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;/code&#62;&#60;br /&#62;
switch data_cast&#60;br /&#62;
    case 'off'&#60;br /&#62;
        castZeros = @(sz) zeros(sz);&#60;br /&#62;
        precision = 'double';&#60;br /&#62;
    case 'single'&#60;br /&#62;
        castZeros = @(sz) zeros(sz, 'single');&#60;br /&#62;
        precision = 'single';&#60;br /&#62;
    case 'gsingle'&#60;br /&#62;
        castZeros = @(sz) gzeros(sz, 'single');&#60;br /&#62;
        precision = 'single';&#60;br /&#62;
    case 'gdouble'&#60;br /&#62;
        castZeros = @(sz) gzeros(sz, 'double');&#60;br /&#62;
        precision = 'double';&#60;br /&#62;
    case 'gpuArray'&#60;br /&#62;
        if strcmp(data_cast_prepend, 'single')&#60;br /&#62;
            if verLessThan('distcomp', '6.2')&#60;/p&#62;
&#60;p&#62;                % original syntax to initialise array of zeros&#60;br /&#62;
                castZeros = @(sz) parallel.gpu.GPUArray.zeros(sz, 'single');&#60;/p&#62;
&#60;p&#62;            else&#60;/p&#62;
&#60;p&#62;                % current syntax to initialise array of zeros&#60;br /&#62;
                castZeros = @(sz) gpuArray.zeros(sz, 'single');&#60;/p&#62;
&#60;p&#62;            end&#60;br /&#62;
            precision = 'single';&#60;br /&#62;
        else&#60;br /&#62;
            if verLessThan('distcomp', '6.2')&#60;/p&#62;
&#60;p&#62;                % original syntax to initialise array of zeros&#60;br /&#62;
                castZeros = @(sz) parallel.gpu.GPUArray.zeros(sz, 'double');&#60;/p&#62;
&#60;p&#62;            else&#60;/p&#62;
&#60;p&#62;                % current syntax to initialise array of zeros&#60;br /&#62;
                castZeros = @(sz) gpuArray.zeros(sz, 'double');&#60;/p&#62;
&#60;p&#62;            end&#60;br /&#62;
            precision = 'double';&#60;br /&#62;
        end&#60;br /&#62;
    case 'kWaveGPUsingle'&#60;br /&#62;
        castZeros = @(sz) zeros(sz, GPUsingle);&#60;br /&#62;
        precision = 'single';&#60;br /&#62;
    case 'kWaveGPUdouble'&#60;br /&#62;
        castZeros = @(sz) zeros(sz, GPUdouble);&#60;br /&#62;
        precision = 'double';&#60;br /&#62;
    otherwise&#60;br /&#62;
        error('Unknown ''DataCast'' option');&#60;br /&#62;
end&#60;br /&#62;
&#60;code&#62;&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bob2024 on "Unrecognized function castZeros in kspaceFirstOrder_createStorageVariables.m"</title>
			<link>http://www.k-wave.org/forum/topic/unrecognized-function-castzeros-in-kspacefirstorder_createstoragevariablesm#post-9140</link>
			<pubDate>Sun, 08 Sep 2024 17:49:48 +0000</pubDate>
			<dc:creator>bob2024</dc:creator>
			<guid isPermaLink="false">9140@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;What does this castZeros() function mean here? There is no such function in MATLAB.&#60;br /&#62;
If you call it you will get error: Unrecognized function or variable 'castZeros'.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;/code&#62;`&#60;br /&#62;
% create storage and scaling variables - all variables are saved as&#60;br /&#62;
    % fields of a structure called sensor_data&#60;/p&#62;
&#60;p&#62;    % if only p is being stored (i.e., if no user input is given for&#60;br /&#62;
    % sensor.record), then sensor_data.p is copied to sensor_data at the&#60;br /&#62;
    % end of the simulation &#60;/p&#62;
&#60;p&#62;    % time history of the acoustic pressure&#60;br /&#62;
    if flags.record_p &#124;&#124; flags.record_I &#124;&#124; flags.record_I_avg&#60;br /&#62;
        sensor_data.p = castZeros([num_sensor_points, num_recorded_time_points]);&#60;br /&#62;
    end&#60;/p&#62;
&#60;p&#62;    % maximum pressure&#60;br /&#62;
    if flags.record_p_max&#60;br /&#62;
        sensor_data.p_max = castZeros([num_sensor_points, 1]);&#60;br /&#62;
    end&#60;/p&#62;
&#60;p&#62;    ......&#60;br /&#62;
&#60;code&#62;&#60;/code&#62;`
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
