Working with unknown requirements

basic newbe errors

learning example x - i did spend an hour+ looking for easy answers, before posting, thx

function nout=numz()
nout = list()
for i=1:100
nout(0) = i
end
endfunction

→ disp(numz())
(1) = 100
(2) = 99
(3) = 98
(4) = 97
(5) = 96
(6) = 95
(7) = 94
(8) = 93
(9) = 92
(10) = 91
(11) = 90
(12) = 89
(13) = 88
(14) = 87
(15) = 86
(16) = 85…

→ histplot(20,numz())
at line 60 of function histplot ( /Applications/Scilab-2024.0.0.app/Contents/share/scilab/modules/graphics/macros/histplot.sci line 78 )

histplot: Wrong type for input argument #2: Real expected.

compare these two routines, and see what you discover

function nout=numz()
nout = list()
for i=1:100
nout(0) = i // auto appends to front of the list
end
endfunction

function nout=numz()
nout = ;
for i=100:-1:1
nout = [nout,i]; // auto appends to end of list
end
endfunction

Hello,

as explained in the documentation (see what you discover) the second argument of histplot has to be a vector (of reals). In general, although they may look sometimes the same, vectors and lists are different types in Scilab. A list is a general purpose container, i.e. elements can be of different types, although vectors/arrays elements have the same type.

S.