"( )" Assignment
You can assign elements into a tall array using the general syntax A(m,n,…) = B. The tall array A must exist. The subscripts m,n,… cannot exceed the dimensions of A, and the first subscript m must be either a colon : or a tall logical vector. With this syntax, B can be:
- Scalar
- A tall array with the appropriate size
- An empty matrix, []
However, I get the following error message "In the assignment A(m,n,…)=B, B must be a scalar value.", when I execute my code. I am simply trying to proces some files consisting of 5 columns. The last column contains strings of the format '2016-12-31 00:01:00 UTC'. I want to convert this last column into the datetime data type. For this I think I first need to remove the trailing ' UTC', as including literal characters at the end of a datetime InputFormat does not seem to work (unlike, e.g., '2016-12-31T00:01:00' that can be formatted as 'uuuu-MM-dd''T''HH:mm:SS'). With the following code I try to remove the ' UTC' wherever it is present in my last column. The code fails at the last statement (and I have checked the sizes).
ds = datastore(some_path,'ReadVariableNames',true,'NumHeaderlines',0,'Delimiter',delimiter,'TextscanFormats',{'%s','%s','%s','%f','%s'},'TextType','string','ReadSize','file');rdata = tall(ds);TF = endsWith(rdata.UtcTime(:),' UTC');lC = rdata.UtcTime;B = replace(lC(TF,1),' UTC','');lC(TF) = B;
Am I misinterpreting the documentation or what could be the reason for this error?
Best Answer