Discussion:
Converting Matlab to Scilab Questions
(too old to reply)
f***@invalid.domain
2009-04-27 14:43:46 UTC
Permalink
I'm attempting to convert a matlab based class to a scilab based class.
Questions:

1. A Movie command? matlab has a Movie command; and a way to store it
to an external file format (movie2avi).

2. If A is a matrix the matlab command image(A) and the scilab command
Matplot(A) are similar but have the (1,1) locations in upper left and
lower left respectively. One can change A to get the images to match the
images, but is there a command that will reverse the direction of the
y axis? (like matlab's axis ij?)

3. A matlab m file say foo.m which defines a function which must be foo;
the file's a comment lines appear when one types help foo.

I can do unix_w("grep // foo.sci"), is there something better? (How
does one grep in windows?)

enough for now.
--
Steven Bellenot http://www.math.fsu.edu/~bellenot
Professor and Associate Chair phone: (850) 644-7405
Department of Mathematics office: 223 Love
Florida State University email: bellenot at math.fsu.edu
ycollet
2009-04-28 07:06:30 UTC
Permalink
Hello,
1. A Movie command? matlab has a Movie command; and a way to store it to an external file format (movie2avi).
I think you must have a look at the SIP or SIVP toolboxes:
- http://siptoolbox.sourceforge.net/
- http://sivp.sourceforge.net/
2. If A is a matrix the matlab command image(A) and the scilab command Matplot(A) are similar but have the (1,1) locations in upper left and
lower left respectively. One can change A to get the images to match the images, but is there a command that will reverse the direction of the
y axis? (like matlab's axis ij?)
The "easier" solution I found:

A = ceil(100*rand(50,50));
subplot(2,1,1);
Matplot(A);
subplot(2,1,2);
Matplot(A($:-1:1,:)) // To reverse one axis of the matrix
3. A matlab m file say foo.m which defines a function which must be foo; the file's a comment lines appear when one types help foo.
I can do unix_w("grep // foo.sci"), is there something better? (How does one grep in windows?)
There is such a possibility under scilab, but I don't remember yet the
format of the comment so as to have useful doc within the script
You can prebuild a .xml file from a .sci script using scipad too.

YC
f***@invalid.domain
2009-04-28 20:34:59 UTC
Permalink
Post by ycollet
Hello,
1. A Movie command? matlab has a Movie command; and a way to store it to an external file format (movie2avi).
- http://siptoolbox.sourceforge.net/
- http://sivp.sourceforge.net/
Hmmm... while these are cool; neither seem to match my current
use of movies, which in matlab uses something like
for i=1:n
image/plot/whatever/calculation
M(i) = getframe;
end;
movie(M,number_repeats,frames_per_second);
movie2avi(M,'myMovie','fps',frames_per_second);

Hmmm... sivp has reading a frame from an image file but can it read
an image from a graphic window? (The grayplot?) Or do I suck up
a pixmap?

Maybe my question is about getframe. I could try making movie
via
for j = 1:number_repeats
for i = 1:last_frame
show(M(i));
sleep(the right amount)
end
end;
Post by ycollet
2. If A is a matrix the matlab command image(A) and the scilab command Matplot(A) are similar but have the (1,1) locations in upper left and
lower left respectively. One can change A to get the images to match the images, but is there a command that will reverse the direction of the
y axis? (like matlab's axis ij?)
A = ceil(100*rand(50,50));
subplot(2,1,1);
Matplot(A);
subplot(2,1,2);
Matplot(A($:-1:1,:)) // To reverse one axis of the matrix
But this leaves the y axis tick marks `reversed' one also needs
a=get("current_axes");
a.y_ticks.labels=a.y_ticks.labels($:-1:1);
to make the ticks correct on the y-axis.

Hmmm... maybe that is the solution.
--
Steven Bellenot http://www.math.fsu.edu/~bellenot
Professor and Associate Chair phone: (850) 644-7405
Department of Mathematics office: 223 Love
Florida State University email: bellenot at math.fsu.edu
s***@univ-lemans.fr
2009-04-29 09:20:07 UTC
Permalink
Post by f***@invalid.domain
Hmmm... while these are cool; neither seem to match my current
use of movies, which in matlab uses something like
for i=1:n
        image/plot/whatever/calculation
        M(i) = getframe;
end;
movie(M,number_repeats,frames_per_second);
movie2avi(M,'myMovie','fps',frames_per_second);
Hmmm... sivp has reading a frame from an image file but can it read
an image from a graphic window? (The grayplot?) Or do I suck up
a pixmap?
Maybe my question is about getframe. I could try making movie
via
for j = 1:number_repeats
        for i = 1:last_frame
                show(M(i));
                sleep(the right amount)
        end
end;
You may use xs2gif() to grab a graphic window. Then, ffor gathering
& merging a series of images into a movie cannot be done with
scilab, you might use "convert". See help xs2gif
Post by f***@invalid.domain
.../...
But this leaves the y axis tick marks `reversed' one also needs
a=get("current_axes");
a.y_ticks.labels=a.y_ticks.labels($:-1:1);
to make the ticks correct on the y-axis.
You may try also a.axes_reverse(2)='on'
may be without any previous reversing of data.

SG
s***@univ-lemans.fr
2009-04-28 17:16:13 UTC
Permalink
Post by f***@invalid.domain
I'm attempting to convert a matlab based class to a scilab based class.
1. A Movie command? matlab has a Movie command; and a way to store it
to an external file format (movie2avi).
SIVP toolbox for SCilab 5.x is already available for Windows as well
as for Linux/unix
"V" of SIVP stands for Video. i am not sure that SIP proposes video
processing.
SIP's availability for Scilab 5.x / Windows is pending (more static
image processing
routines than in SIVP).
Post by f***@invalid.domain
2. If A is a matrix the matlab command image(A) and the scilab command
Matplot(A) are similar but have the (1,1) locations in upper left and
lower left respectively. One can change A to get the images to match the
images, but is there a command that will reverse the direction of the
y axis? (like matlab's axis ij?)
See the flipdim() function (just to mimic matlab. Yann's recipe is
efficient).
Post by f***@invalid.domain
3. A matlab m file say foo.m which defines a function which must be foo;
the file's a comment lines appear when one types help foo.
After loading the function (with exec myfile.sci ), then use
head_comments(functionName). It will display the function's prototype,
and then the first bloc of comments written in the script after it,
down to the first line that is not a comment. So there should be
no white line between the "function" line and the first helping line.
Various functions defined in the same myfile.sci may be handdle
by head_comments() in the same way.

Example:
function rep=foo(arg1)
// This must be the first line of the comment, with no preceding white
line
//
// end of comment displayed by head_comments('foo') (not head_comments
('myfile') )

// Additionnal comment after a breaking white line
disp("Hello");
endfunction

hth,
Samuel
d***@gmail.com
2018-06-01 04:26:58 UTC
Permalink
Post by f***@invalid.domain
I'm attempting to convert a matlab based class to a scilab based class.
1. A Movie command? matlab has a Movie command; and a way to store it
to an external file format (movie2avi).
2. If A is a matrix the matlab command image(A) and the scilab command
Matplot(A) are similar but have the (1,1) locations in upper left and
lower left respectively. One can change A to get the images to match the
images, but is there a command that will reverse the direction of the
y axis? (like matlab's axis ij?)
3. A matlab m file say foo.m which defines a function which must be foo;
the file's a comment lines appear when one types help foo.
I can do unix_w("grep // foo.sci"), is there something better? (How
does one grep in windows?)
enough for now.
--
Steven Bellenot http://www.math.fsu.edu/~bellenot
Professor and Associate Chair phone: (850) 644-7405
Department of Mathematics office: 223 Love
Florida State University email: bellenot at math.fsu.edu
What is the equivalent of getframe() command of MATLAB in SCILAB?
Loading...