[Scilab-users] Basic query - mprintf
Stefan Du Rietz
sdr at durietz.se
Thu Apr 7 12:01:05 CEST 2022
Of course you don't need to make the string s.
You have to transpose fac to get a column vector for mprintf and then
transpose the column string vector to get a row string vector:
--> fac = msprintf("%d\n", fac')'
fac =
"7" "13" "19"
and then concatenate the string so that it works for a variable number
of elements in fac:
--> mprintf("Factors of 1729 are: %s", strcat(fac," "))
Stefan
On 2022-04-07 11:30, Stefan Du Rietz wrote:
> Hello Lester,
>
> --> s = msprintf("Factors of 1729 are: ");
> s =
> "Factors of 1729 are: "
> --> fac = msprintf("%d\n", fac')'
> fac =
> "7" "13" "19"
> --> mprintf("%s%s", s, strcat(fac, " "))
> Factors of 1729 are: 7 13 19
>
> Regards
> Stefan
>
>
> On 2022-04-07 09:50, Lester Anderson wrote:
>> Hello all,
>>
>> Very basic query but how do you print all the values from a result via
>> mprintf?
>>
>> e.g.
>>
>> fac = factor(1729)
>> 7 13 19
>>
>> mprintf('Factors of 1729 are: %d\n', fac)
>> just prints 'Factors of 1729 are: 7
>>
>> Sorry for the basic question!
>> Cheers
>> Lester
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
More information about the users
mailing list