<div dir="ltr">Hey<div><br></div><div>You have not created the variable in the file. First you have to create a variable in the following file using the command nccreate(filename, 'Hilb_Hy', 'Dimensions', list('r', no_row, 'c', no_column); after that you can pass the ncwrite command and you have to pass like this <span style="font-size:12.8px">ncwrite(filename, 'Hilb_Hy',Hy) as Hy is a matrix.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Regards</span></div><div><span style="font-size:12.8px">Harpreet Singh</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 5, 2016 at 4:01 PM, Lester Anderson <span dir="ltr"><<a href="mailto:arctica1963@gmail.com" target="_blank">arctica1963@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Harpreet,<br>
<br>
I altered the code a bit but still get a problem<br>
<br>
Hy = hilbert(grav);<br>
filename = fullfile('Q:\geophys\Gz_Hy.grd') // set output filename<br>
// ncwrite(filename, varname, vardata, [start, [stride]])<br>
ncwrite(filename, 'Hilb_Hy','Hy') // write variable Hilb_Hy with data from Hy<br>
<br>
Error message:<br>
<br>
ncwrite(filename, 'Hilb_Hy','Hy') // write variable Hilb_Hy with data from Hy<br>
                                  !--error 999<br>
ncwrite: nc_inq_varid() returned the error -49: NetCDF: Variable not found.<br>
at line       6 of exec file called by :<br>
<span class="">exec('Q:\geophys\Lester\SCILAB_work\netcdf1.sce', -1)<br>
<br>
</span>In this case I want to define a variable name Hilb_Hy (although can<br>
use any name really) in the netCDF file and write the output of the<br>
Hilbert (Hy) transform.<br>
<br>
Cannot see the solution<br>
<br>
<br>
<br>
On 5 February 2016 at 10:15, Harpreet Singh Rathore<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:harpreet.mertia@gmail.com">harpreet.mertia@gmail.com</a>> wrote:<br>
> Dear Lester,<br>
><br>
> As I can see the error is saying minimum 3 inputs are required. And after<br>
> going through the help of the following function, you also have to pass the<br>
> value which you have to store in the 'Hy'. You can go through the help files<br>
> of ncwrite by typing help ncwrite in the console.<br>
><br>
> Regards<br>
> Harpreet<br>
><br>
> On Fri, Feb 5, 2016 at 3:18 PM, Lester Anderson <<a href="mailto:arctica1963@gmail.com">arctica1963@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Hello all<br>
>><br>
>> I am looking to use the sciNetCDF module to work with GMT grid files<br>
>> but have some issues.<br>
>><br>
>> Reading a GMT grid is not a problem as far as I can tell, so the<br>
>> following does read the file (and z variable), storing the values in<br>
>> the grav array:<br>
>><br>
>> source = fullfile('Q:\geophys\Gz.grd')<br>
>> grav = ncread(source,'z')<br>
>> Hy = hilbert(grav); // write Hy variable to new file<br>
>><br>
>> I am having problems with writing out the processed data e.g write a<br>
>> new grid (Gz_Hy.grd) with the Hilbert transform solution<br>
>><br>
>> filename = fullfile('Q:\geophys\Gz_Hy.grd')<br>
>> ncwrite(filename, 'Hy') // does not work<br>
>><br>
>> Error return:<br>
>><br>
>> ncwrite(filename, 'Hy')<br>
>>                        !--error 77<br>
>> ncwrite: Wrong number of input argument(s): 3 to 5 expected.<br>
>> at line       5 of exec file called by :<br>
>> exec('Q:\geophys\Lester\SCILAB_work\netcdf1.sce', -1)<br>
>><br>
>> Any advice would be appreciated.<br>
>><br>
>> Thanks<br>
>> Lester<br>
>> _______________________________________________<br>
>> users mailing list<br>
>> <a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
>> <a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
><br>
><br>
><br>
><br>
> --<br>
> Thanks and Regards<br>
> Harpreet Singh<br>
><br>
> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
> <a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
><br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Thanks and Regards<br></div>Harpreet Singh<br></div></div>
</div>