Is there a limit to data storage in a string in Mac ?

I have written a procedure where the program asks the user to enter characters separated by ',' to be stored in a String, it is then converted into a wave. The first step is:

Prompt timedelays, "Time Delays"
DoPrompt "Delay times of your experiment", timedelays

The time delays entered by the user are like this : 10, 20, 30, 40, 50 ...

The string 'timedelays' is now converted into a wave with this:

variable numT2 = ItemsInList(timedelays, ",")
make/O/N=(numT2) T2wave
for(i=0; i<numT2; i+=1)
    tmp_T2 = str2num(StringFromList(i,timedelays,","))
    T2wave[i] = tmp_T2
endfor

This procedure works perfectly well in my Windows PC, however when a colleague of mine uses this on his Mac, there seems to be a limit to the characters he can enter into the 'timedelay' string. I have checked this with other people using Windows and Mac systems (both in 32-bit and 64-bit), and it seems the Mac limits the values.

For example; timedelay I enter in my Windows system is

timedelays = "-400, -300, -200, -100, -50, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 325, 350, 375, 400, 425, 450, 475, 500, 525, 550, 575, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1250, 1500, 1750, 2000, 2250, 2500, 2750, 3000, 3250, 3500, 5000, 10000, 20000, 30000"

while my colleague can enter till the first 32 or 35 characters including the spacers.

How can I overcome this in Mac (assuming this might be a Mac issue) ?

I don't know anything about Macs, but you could ask the user for the number of time delays instead and then make and Edit the wave, which will allow the user to enter the values directly into the wave. Or if you want to be fancy you could use a listbox.

On a side note, you can enter the values from the stringlist into the wave in one line with

make/O/N=(numT2) T2wave=str2num(StringFromList(p, timedelays, ","))

 

I believe the limit for DoPrompt is 255 characters in Igor6, 1000 in Igor7 and 2500 in Igor8.

If this does not solve the problem, if you post a fully-functional minimal example that I can run, I will investigate.

Also state what versions of Igor you are using.

 

In reply to by olelytken

olelytken wrote:

I don't know anything about Macs, but you could ask the user for the number of time delays instead and then make and Edit the wave, which will allow the user to enter the values directly into the wave. Or if you want to be fancy you could use a listbox.

On a side note, you can enter the values from the stringlist into the wave in one line with

make/O/N=(numT2) T2wave=str2num(StringFromList(p, timedelays, ","))

 

 

Well I'll be !! Makes the code shorter and easier to read. Thanks !!

And the reason I wanted the user to enter the timedelays all at once and then make into a wave is because, the timedelays are not consistent (or consecutive) ... -50, -40, -20, 0, 5, 10, 20, 50... And there are more than 100 time delays, which nobody wanted to type manually. Instead this method allowed us to copy the timedelays from a file into Igor (this has made our life so much easier, so we wanted to keep this method).

In reply to by hrodstein

hrodstein wrote:

I believe the limit for DoPrompt is 255 characters in Igor6, 1000 in Igor7 and 2500 in Igor8.

If this does not solve the problem, if you post a fully-functional minimal example that I can run, I will investigate.

Also state what versions of Igor you are using

Function AskTime()
        string timedelays
    variable numT2, i=0
    Prompt timedelays, "Time Delays"
    DoPrompt "Delay times of your experiment", timedelays
    if(V_flag==1)
        Abort "Try again later ?"
    endif
    numT2 = ItemsInList(timedelays, ",")
    make/O/N=(numT2) T2wave = str2num(StringFromList(p, timedelays, ","))
end

cleaned up the code as suggested by @olelytken. Running AskTime() will bring up a dialogbox to enter times (separated by listSepStr) which will be turned into a one-dimensional wave. To give you an example, the timedelays I'll be working with are like these:

-0.7, -0.525, -0.35, -0.175, 0, 0.175, 0.35, 0.525, 0.7, 0.875, 1.05, 1.225, 1.4, 1.575, 1.75, 1.925, 2.1, 2.275, 2.45, 2.625, 2.8, 2.975, 3.15, 3.325, 3.5, 3.675, 3.85, 4.025, 4.2, 4.375, 4.55, 4.725, 4.9, 5.075, 5.25, 5.425, 5.6, 5.775, 5.95, 6.125, 6.3, 6.475, 6.65, 6.825, 7, 7.175, 7.35, 7.525, 7.7, 7.875, 8.05, 8.225, 8.4, 8.575, 8.75, 8.925, 9.1, 9.275, 9.45, 9.625, 9.8, 9.975, 10.15, 10.325, 10.5, 10.675, 10.85, 11.025, 11.2, 11.375, 11.55, 11.725, 11.9, 12.075, 12.25, 12.425, 12.6, 12.775, 12.95, 13.125, 13.3, 13.475, 13.65, 13.825, 14, 14.175, 14.35, 14.525, 14.7, 14.875, 15.05, 15.225, 15.4, 15.575, 15.75, 15.925, 16.1, 16.275, 16.45, 16.625, 16.8, 16.975, 17.15, 17.325, 17.5

Igor version we use is 6.37 (64-bit)

Note: These timedelays are generated from our experiment and stored in a notepad.

But I would like to ask, is there a way I can copy the timedelays (like from a notepad file) to igor and make a wave ? The reason we don't want to create a wave in igor is because we use such a large number of timedelays and no one really wants to enter those numbers manually. I wrote this code but there's the character limitation.

It does appear that the limit for DoPrompt is larger on Windows than on Macintosh in Igor6. There is no way to change the limit on either platform, other than upgrading to Igor8.

Quote:
is there a way I can copy the timedelays (like from a notepad file) to igor and make a wave

Assuming that the data in the Notepad file is all on one line and uses comma as a delimiter, you can execute this to load it from the file:

Function LoadNotepadFile()
    LoadWave/J/M/Q              // Displays dialog
    if (V_flag == 0)
        return -1               // Nothing loaded - probably user cancelled
    endif
   
    String nameOfWave = StringFromList(0, S_waveNames)
    Wave w = $nameOfWave
    Variable numPoints = numpnts(w)
    Redimension/N=(numPoints) w     // Redimension as 1D
    Printf "Loaded wave %s, %d points\r", nameOfWave, numPoints
   
    return 0        // Success
End

Alternatively, you can copy it to the clipboard and then execute this:

// Copy data to the clipboard and then execute this
Function LoadFromClipboard()
    // Load into a 2D wave (matrix)
    LoadWave/J/M/Q "Clipboard"      // Loads from clipboard
    if (V_flag == 0)
        return -1               // Nothing loaded
    endif
   
    String nameOfWave = StringFromList(0, S_waveNames)
    Wave w = $nameOfWave
    Variable numPoints = numpnts(w)
    Redimension/N=(numPoints) w     // Redimension as 1D
    Printf "Loaded wave %s, %d points\r", nameOfWave, numPoints
   
    return 0        // Success
End

 

 

In reply to by hrodstein

hrodstein wrote:

Alternatively, you can copy it to the clipboard and then execute this:

// Copy data to the clipboard and then execute this
Function LoadFromClipboard()
    // Load into a 2D wave (matrix)
    LoadWave/J/M/Q "Clipboard"      // Loads from clipboard
    if (V_flag == 0)
        return -1               // Nothing loaded
    endif
   
    String nameOfWave = StringFromList(0, S_waveNames)
    Wave w = $nameOfWave
    Variable numPoints = numpnts(w)
    Redimension/N=(numPoints) w     // Redimension as 1D
    Printf "Loaded wave %s, %d points\r", nameOfWave, numPoints
   
    return 0        // Success
End

 

I tried the copy to clipboard and it works. I think I'll insert this code into my program. Thank you !