0
votes

I want to hide an image inside an big image using SciLab tools, following is the code snippet I am using

S1_diag = diag(s1);
S2_diag = diag(s2);

S1_diag(1:length(s1), :) = S2_diag(1:length(s1), :);

where s1 and s2 are image 1 and 2's singular diagonal matrix

The same code works in Matlab but generates an 'Invalid Index' error (21) in SciLab. What I am missing?

I am novice in SciLab syntax so couldn't understand how to address this in SciLab.

Any help is appreciated.

1
There is no guarantee that scilab will work exactly like matlab. This is the main reason to stick to only one program if possible. However, any of these operations should work.patrik

1 Answers

0
votes

The reason is that the length command is not the same for Scilab and Matlab.

  • in Matlab, length gives the maximum dimension of a matrix. So, for a 2-by-3 matrix it is 3.
  • in Scilab, length gives the number of elements. So, for a 2-by-3 matrix it is 6.

Here's a little dictionary:

  • Matlab's length(A) is the same as Scilab's max(size(A))
  • Scilab's length(A) is the same as Matlab's numel(A)