New answers tagged

3

Let's walk through this solution to see how it works. First, we define some groups of characters. The characters that are in spChar list are characters like "!" and "_". They will be sorted in the order they appear in the list. This does not include all the special characters, because I do not know what order they should have. The characters in the ...


4

If test is a list of numbers, your code works fine: f[x_] := (If[x > 0, x*n1, 0]) test = {1, 2, 3, -1}; f /@ test (* {n1, 2 n1, 3 n1, 0} *) If you import test from an Excel file, Mathematica might give you a 2D array (Excel sheets are like matrices). You can use Flatten to convert it to a flat list, or alternatively use Part with All (please check ...



Top 50 recent answers are included