Matlab! 나는이 오픈 소스 코드를 가지고 내가 원하는 것을 할 수 있도록 해왔다.하지만 그렇게하고 싶지는 않지만 그렇게하고 싶다. 이걸 감싸는 데 도움이 필요해.Matlab : 행렬에 데이터 저장
clear
global geodesic_library;
geodesic_library = 'geodesic_debug'; %"release" is faster and "debug" does additional checks
rand('state', 0); %comment this statement if you want to 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 a mesh
mesh = geodesic_new_mesh(vertices,faces); %initilize new mesh
algorithm = geodesic_new_algorithm(mesh, 'exact'); %initialize new geodesic algorithm
vertex_id = 6707 ; %create a single source at vertex #1
source_points = {geodesic_create_surface_point('vertex',vertex_id,vertices(vertex_id,:))};
geodesic_propagate(algorithm, source_points); %propagation stage of the algorithm (the most time-consuming)
vertex_id = 12240; %create a single destination at vertex #N
destination = geodesic_create_surface_point('vertex',vertex_id,vertices(vertex_id,:));
path = geodesic_trace_back(algorithm, destination); %find a shortest path from source to destination
distances = zeros(N,1); %find distances to all vertices of the mesh (actual pathes are not computed)
[source_id, distances] = geodesic_distance_and_source(algorithm) %find distances to all vertices of the mesh; in this example we have a single source, so source_id is always equal to 1
geodesic_delete; %delete all meshes and algorithms
그것은 거리를 출력 한 후, 다음 코드에서,이 경로을 나타내는 :
이것은 내가 지금까지있는 것입니다.
여기 내 문제가 있습니다. 그것은 내 "소스"각각에 해당하는 12000+ 거리를 출력하지만, 정점과면에 의해 주어진 10 개의 소스와 12 개의 목적지 사이의 거리 만 신경 써야합니다. 내가 염려하는 120 가지 거리를 인쇄하여 매트릭스에 저장할 수있는 방법은 무엇입니까?
여기 [link] (http://stackoverflow.com/questions/32379805/linear-indexing-logical-indexing-and-all-that) 및 여기 [link] (http : //www.mathworks .com/company/newsletters/articles/matrix-indexing-in-matlab.html). – Rotem