annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

What is the easiest way to always increment to index 0 only for a multi-element array ?

Risolto!
Vai alla soluzione

The premise is to populate a spreadsheet from left to right in the same row but incrementing the column letter only (ie - B4, then C4 etc). Attached I have customized an existing example VI that works for a 2 element array (ie - B4) but does not work for a 3 element array (ie - B40, then becomes B50). Keeping it simple, what is the best and easiest way to modify my existing code to always check the array size and automatically index back to 0 in order to properly increment the first letter only (ie - B) and not the number (ie - 4) ?

 

Thanks !

 

Barry

  

0 Kudos
Messaggio 1 di 5
3.279Visualizzazioni
Soluzione
Accettato da autore argomento biernaskieb

Instead of "automatically index back to zero" , why not just make it a zero instead of doing the array size -1-1 manipulations?

 

Of course this will all fall apart once you get to column Z.

 

Also look into the Excel Board.   Don't post question there.  It is just a link to other threads related to Excel.  Some of them might give you better ideas how to manipulate your cell references.

0 Kudos
Messaggio 2 di 5
3.271Visualizzazioni

Yup it works ! I modified the code as suggested (initializing index to always be 0 with a 0 constant). I tried various numbers of elements in the array and they all work !

 

Thanks for the suggestion !

 

Barry

 

0 Kudos
Messaggio 3 di 5
3.260Visualizzazioni

In case you ever have more than 26 columns (as Ravens Fan noted), here is some code I use to generate the column label from the column number (0=A,1=B,...).

 

 

0 Kudos
Messaggio 4 di 5
3.245Visualizzazioni

Thanks for the code suggestion ! This will definitely come in handy for those Mega Data Spreadsheets that require data collection automation using LabVIEW !

 

Thanks again !

 

Barry

 

0 Kudos
Messaggio 5 di 5
3.225Visualizzazioni