-
Notifications
You must be signed in to change notification settings - Fork 708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows 11 or >=R2021b file reading errors #2082
Comments
Edit to add Win11/R2021a shows the same errors. |
I don't have a Windows 11 machine to test on. Can you try |
Hi Matt, did you already find time to further look into this? |
I think I have found the issue. Somewhere along the line, Matlab or Windows, has changed how string concatenation works in Matlab. In ft_read_header, there is a call Outputs
The string splits at the |
Specifically, in
This change in shorthand string concatenation with string variables has also cropped up elsewhere on my new system in other Matlab work. I'll note that the behaviour has been irritating ,eg.
returns
but
where
What happened here is Instead, I had to use
returns
Some quick testing, this seems to not be consistent behaviour. I couldn't say why... The only helpful suggestion/workaround I have at the moment is to recommend |
OK, thanks for looking into it. I think that the solution with the '+' is not robust for older matlab versions, and I don't know about append(). We may need to consider to change the square bracket syntax into strcat() operations to stay future proof (and maintain backward compatibility). Oh my... BTW, your pasted solution with the fullfile() in dataset2files was your doing, right? Would it be possible to file a PR for that? |
BTW >=R2021b on Linux seems to run fine in my experience. |
Hi @mjcourte I think the below behavior reproduces the basis of this issue. If I do (on matlab2021a): s = ['a' 'b'], I get 'ab' if I do: s = ["a" "b"], I get a 1x2 string array. Long story short, the FT syntax has not been updated to be robust against a mixed usage of chars and the newer 'string' class in matlab |
This is from one of the old version of FT that I had lying around, 20190709. I tested this with 20220104, 20220727 as well and they had the same issues, however I did not debug or see the diff in dataset2files.
To complicate this, the version of dataset2files that has [path 'ext'] is returning the string arrays on my Windows 11 machine, even with the single quotes I ended up the scripts for this particular project on our Linux node and whatever version(s) of Fieldtrip are installed there worked without issue. What I think I can do--when I find the time--is spin up a couple VMs of Windows 10, 11, Linux, install Matlab and FT and see if I can reproduce (or not) the problem in all environments. |
I still think it's a string vs char issue. If I cd into /fileio/private, and do [a,b,c] = dataset2files("/a/b/c.ds", 'ctf_ds') % double quotes I get: a =
b = 1×2 string array
c = 1×2 string array
If right after that I do: [a,b,c] = dataset2files('/a/b/c.ds', 'ctf_ds') % single quotes I get: a =
b = 1×2 string array
c = 1×2 string array
But if I do: clear dataset2files I get: a =
b =
c =
As desired. |
Given that it is probably not straightforward to robustify this issue across the codebase, I would vote for an explicit check - and if needed - string2char conversion in ft_checkconfig. What does @robertoostenveld think? |
Following up on my previous comment, I think that theoretically the best way to enforce a char (instead of string) is to adjust ft_getopt. Practically, this would require updating the c-code, and recompiling the mex-file for all OS's ... |
Two errors I have encountered in my Win11 environment. Originally with R2021b, then with R2022a. Fieldtrips 20191213, 20220104, 20220727.
In my Ubuntu 20.04 LTS environment with R2021a, Fieldtrip 20191213, these files all load fine. Thats my old laptop with not enough RAM for the job.
Returns:
Returns:
isfile()
orisfolder()
as approriate.ft_filetype(ds_C_path)
, it returns'ctf_ds'
as expected.~contains ... && isfolder ...
, on theds_C_path
it returns true.I'm installing R2021a on my Win11 machine now to see if this reproduces.
The text was updated successfully, but these errors were encountered: