arrays - Matlab: Saving data in a matrix -


new matlab! i've been messing around open source code make want , does, not way want to. need wrapping up.

this have far:

clear  global geodesic_library;                 geodesic_library = 'geodesic_debug';      %"release" faster , "debug" additional checks rand('state', 0);                         %comment statement if want produce random mesh every time  load v3_elements4geodesicd.k load v3_nodes4geodesicd.k  vertices = v3_nodes4geodesicd (:, [2 3 4]); faces = v3_elements4geodesicd (:, [3 4 5]);  n = 12240;                                  %number of points in mesh  mesh = geodesic_new_mesh(vertices,faces);         %initilize new mesh algorithm = geodesic_new_algorithm(mesh, 'exact');      %initialize new geodesic algorithm  vertex_id = 6707 ;                             %create single source @ vertex #1 source_points = {geodesic_create_surface_point('vertex',vertex_id,vertices(vertex_id,:))};  geodesic_propagate(algorithm, source_points);   %propagation stage of algorithm (the time-consuming)  vertex_id = 12240;                              %create single destination @ vertex #n destination = geodesic_create_surface_point('vertex',vertex_id,vertices(vertex_id,:)); path = geodesic_trace_back(algorithm, destination);     %find shortest path source destination  distances = zeros(n,1);              %find distances vertices of mesh (actual pathes not computed) [source_id, distances] = geodesic_distance_and_source(algorithm)    %find distances vertices of mesh; in example have single source, source_id equal 1  geodesic_delete;                            %delete meshes , algorithms 

it prints out distances , then, in subsequent code, plots path.

so here's problem. prints out 12000+ distances corresponding each of "sources" care distances between 10 sources , 12 destinations on mesh, given vertices , faces. how can print 120 distances care , store them in matrix?

in matalb, if don't put semicolon @ end of statement, then, output of statement gets printed on console. so, following statement:

[source_id, distances] = geodesic_distance_and_source(algorithm)  

does not have semicolon. suspect that's see 12000 distances printed out.

to answer second question: don't have enough information structure of matrix distances. think can use indexing find out distance between source m , destination n distances(m,n). that's how distance matrices structured, can't sure.


Comments