\documentclass[10pt]{article}
\usepackage{readarray}
\begin{document}
\readarraysepchar{ }
\def\mydata{alpha beta gamma delta}
\readarray\mydata\myarray[-,2]% Read \mydata as 2 fields into 2-D \myarray
Cell (2,2) has \myarray[2,2]
whereas cell (1,2) has \myarray[1,2]
\end{document}

If the data is in a file, also no problem. Note that \readdef
, while reading the file, sets \ncols
to the number of fields detected in the first row and can be used, instead of an explicit 2
, for the \readarray
. I also demonstrate the use of a different separator (comma instead of space) and show how the *
option of \readarray
will remove leading and trailing spaces.
\documentclass[10pt]{article}
\usepackage{readarray,filecontents}
\begin{filecontents*}{mydatafile}
alpha, beta
gamma, delta force
\end{filecontents*}
\begin{document}
\readarraysepchar{,}
\readdef{mydatafile}{\mydata}
\readarray*\mydata\myarray[-,\ncols]% Read \mydata as 2 fields into 2-D \myarray
Cell (2,2) has \myarray[2,2]
whereas cell (1,2) has \myarray[1,2]
\end{document}

FINALLY, if changing cell data on the fly is a requirement, I implement here the macro \setfield\<array name>[<row>,<column>]{<data>}
:
\documentclass[10pt]{article}
\usepackage{readarray}
\makeatletter
\gdef\setfield#1[#2,#3]#4{%
\expandafter\gdef\csname\expandafter\@gobble\string#1[#2,#3]\endcsname{#4}}%
\makeatother
\begin{document}
\readarraysepchar{ }
\def\mydata{alpha beta gamma delta}
\readarray\mydata\myarray[-,2]% Read \mydata as 2 fields into 2-D \myarray
Cell (2,2) has \myarray[2,2]
whereas cell (1,2) has \myarray[1,2]
\setfield\myarray[1,2]{$\beta$}
Cell (1,2) now has \myarray[1,2].
\end{document}
