Bio formats in Matlab - Bfopen - string for filename
Show older comments
I'm trying to read in Zeiss Zen .czi files from a directory with bfopen,
Directory="/home/ian/Zenfiles/airy-neuron/";
Dirlist=dir(fullfile(Directory,'*.czi'));
Filecounter=2 %a loop in full code
Filenamein=Dirlist(Filecounter).name
Newimagename=fullfile(Directory+Filenamein);
Newimage=bfopen(Newimagename);
This appears to produce a correctly formatted file name eg "/home/ian/Zenfiles/airy-neuron/Tile0.czi" but it produces an error -
Error using bfGetReader (line 43)
The value of 'id' is invalid. It must satisfy the function: ischar.
Error in bfopen (line 114)
r = bfGetReader(id, stitchFiles);
Manually typing the file, it appears bfopen needs it written as '/home/ian/Zenfiles/airy-neuron/Tile0.czi' but I can't get that to manifest in the code. I'm probably missing something obvious but I'm going slowly mad. Can anyone help? I have a Tb of images to get through..
Accepted Answer
More Answers (1)
Mario Malic
on 23 Oct 2020
Edited: Mario Malic
on 23 Oct 2020
As seen on the error, you have to provide a file path as a character array.
Quotation marks denote strings, you can adjust your code
Newimagename=char(fullfile(Directory+Filenamein));
Fixed
Newimagename=char(fullfile(Directory,Filenamein));
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!