Mathematica Strange postfix quotes in mathematica output

  • Thread starter wil3
  • Start date
Hello. I am using the Smooth.m mathematica package on a large set of paired data points. Occasionally, instead of getting a number in my output array, I end up with something like this:

1. (0.861515 + (58 "")/2379)

In the output window, the quotes are not visible, but when I copypasta it as input, I can see them. I've played around, and they seem to prevent the expression from being evaluated (perhaps by converting the numerator to a String?). I've tried using ToExpression[], but that doesn't seem to work out.

This is important because the random five or so points I get like this prevent me from using the smoothed output list as an array of Reals.

Thanks for any advice. I'm on OSX with Mathematica 8
Suppose your output array is stored in X.



and carefully inspect the result from that. This should show enough details to determine what is wrong with the result. Perhaps from that we can backtrack to what caused the problem.

If you can narrow the problem down to say the 14't entry in X then you can post the output from


and that will help others diagnose what the problem is if you can't find it yourself.
Okay, I get where you're going with this. Here's a snippet of the output (the rest of the data set is more of the same, with the irrelevant parts of the set elided:

List[List[1.26882, 0.37328, -0.106096, -0.92101, -0.136833],
List[-3.22256, -0.813948, -0.711458, -0.68961, -1.00191],


List[0.655709, 0.0882863, 0.842526, 0.341742, 0.549153], \
List[-0.647317, 0.590783, 0.930406, 0.641969, -1.22252], \
List[-0.669536, -0.712783, -1.47811, 0.109366, -0.496347], \
List[0.943894, -0.733368, -0.541758, 0.128392, 1.09628], \
List[0.24907, 0.403836, 1.12949, -0.757977, -0.566415],
List[-2.01784, 0.822378, 0.608782, 0.0639815, 0.388811], \
List[0.941022, -0.233806, -1.21123, 0.777403, 0.191461], List[
Times[Rational[58, 2379],
""]]], -0.685587, -0.671428, -0.470756, -0.668355], List[
Times[Rational[88, 2379],
""]]], 0.354215, 1.63487, 0.279868, -0.183664], List[-0.439363, \
0.267128, 0.597456, 0.429185, 0.234532], List[1.52809, -0.232724, \
-0.697609, -0.972193, 0.809927],


List[-0.18374, 0.660093, 1.04566, -0.166718, 0.0239493],
List[1.59315, 0.445269, 1.01502, 0.31377, 0.56214]]

So the TimesRational thing is definitely it, but I don't think I understand yet what is going on. Thanks for your help!
Good. So it really does appear that you have a zero character string getting into one of your calculations.

Can you now back up into the calculation of this matrix and insert some

If[y=="",Print["Yikes! y is a null string"]];

and do that for each of the variables that are going to be used next in a calculation.

Hopefully that will help you track down which variable is responsible.
I'm confused as to how to implement that. The code I'm using is:

x =
Riffle[wavelength, hiradmiki1[]], 2],
60, 5],
{i, Length[hiradmiki1]}];

where 60 and 5 are parameters of the Smoothing function. hiradmiki1 is my original absorbance data set, and wavelength is the set of ordinates for each point in the data set (Smooth[] won't let me call a 1D data set alone; I have to give it paired values).

The Partition of the Riffled set looks fine in testing, but once I add the Smooth layer it causes the issue. If I comment out Smooth[], then it generates the unsmoothed table without any issues. Is there a simple command to find and remove all the zero character Strings?
Ah, so you are doing a whole vector against vector.

Try this instead.

Do a FullForm on your savelink and then on your kiradmiki1 and see if there is any chance that a null string might be hiding inside either of those.

You might be able to narrow your search by counting which elements have the "" in them, or you can just manually scan the output, or possibly search for "".
Okay, I got it. So I was importing my data vectors in matrix form from an Excel spreadsheet. The import feature seems to add a layer of dimensionality to the list(I guess with sheet number as the third tensor dimension?), which was getting recorded as a group of null characters because my extra sheets were blank.

I had been transposing, and then flattening the data set(to kick the third dimension), but I needed to do the operations in reverse in order to prevent zero character artifacts of the import process (from the third "sheet number" dimension) from getting scattered throughout my transposed vector.

Thanks very much for your help. I think you've answered some of my other Mathematica questions correctly as well. Pro

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving