title: How to input value to matrix by considering speciall another matrix
body: <p>One possible solution is the following. Note that I took the freedom to assign meaningful names to your variables, as names such as <code>A</code> and <code>Start Time A</code> (which is not even a valid Matlab identifier) are really easy to confuse. Also you can see that your matrices
  <code>C</code> and <code>Start Time C</code> are redundant because all the information is already encoded in <code>A</code>,
  <code>B</code> and <code>Start Time A</code>.</p>
  
  <pre><code>% The values to put in the result matrix.
  value = [5 6 7;
           7 5 6];
  % Column index where each sequence starts in the result matrix.
  start = [2 3 7;
           1 6 8];
  % The length of each sequence, i.e. how often to put the value into the result.
  count = [1 2 3;
           3 1 2];
  
  % Determine the longest row. Note: At this place you could also check, if all 
  % rows are of the same length. The current implementation pads shorter rows with
  % zeros.
  max_row_length = max(start(:, end) + count(:, end) - 1);
  
  % Allocate an output matrix filled with zeros. This avoids inserting sequences
  % of zeros afterwards.
  result = zeros(size(start, 1), max_row_length);
  
  % Finally fill the matrix using a double loop.
  for row = 1 : size(start, 1)
      for column = 1 : size(start, 2)
          s = start(row, column);
          c = count(row, column);
          v = value(row, column);
          result(row, s : s + c - 1) = v;
      end
  end
  </code></pre>
  
  <p>The <code>result</code> is</p>
  
  <pre><code>result =
  
       0     5     6     6     0     0     7     7     7
       7     7     7     0     0     5     0     6     6
  </code></pre>
  
  <p>as requested.</p>
  
  <p>How can I modify the above code for solving 3D matrix. </p>
  
  <p>Example : size of third dimension is 2.
  Matrix Value </p>
  
  <pre><code>value(:,:,1) = [5 6 7;
                  7 5 6];
  value(:,:,2) = [6 5 7;
                  6 7 5];
  
  start(:,:,1) = [2 3 7;
                  1 6 8];
  start(:,:,2) = [1 5 6;
                  2 5 9];
  
  count(:,:,1) = [1 2 3;
                  3 1 2];
  count(:,:,2) = [2 1 3;
                  2 3 1];
  </code></pre>
  
  <p>I wish my result matrix is</p>
  
  <pre><code>result(:,:,1) =[0 5 6 6 0 0 7 7 7;
                  7 7 7 0 0 5 0 6 6]
  result(:,:,2) =[6 6 0 0 5 7 7 7 0;
                  0 6 6 0 7 7 7 0 5]
  </code></pre>
  
  <p>How to make code to make a result. thanks</p>