Thank you Nick, it worked for me.
However I had to perform some small modifications, I think there was a small error with the counting in the node_indices variable.
Here I copy the code modification that worked for me (applied to the synthetic datasets), just in case someone encounters the same problem.
% generate synthetic left and right hemisphere data
% (this is just example data for illustration)
ds_left=cosmo_synthetic_dataset('type','surface','seed',1);
ds_right=cosmo_synthetic_dataset('type','surface','seed',2);
% Set the number of vertices of the left surface.
% If the surface is sparse (it does not have data for all nodes), it *may*
% be necessary to adjust this value manually. In that case, consider to:
%
% - compute the number of vertices, if it is a standardized surface from
% MapIcosahedron. If the ld parameter was set to 64, then the number of
% vertices is 10*64^2+2=40962.
% - get the number of vertices using:
% [v,f]=surfing_read('left_surface.asc');
% nverts=max(size(v));
%
[unused, index]=cosmo_dim_find(ds_left, 'node_indices');
nverts_left=max(ds_left.a.fdim.values{index});
% update node indices to support indexing data from two hemispheres
node_indices=[ds_left.a.fdim.values{index}, ...
nverts_left+ds_right.a.fdim.values{index}];
% merge both hemispheres samples
ds_left_right=cosmo_stack({ds_left,ds_right},2);
% update fdim values
ds_left_right.a.fdim.values = {1:length(node_indices)};
% update node_indices
ds_left_right.fa.node_indices = node_indices;