Why am I getting the error "Brace indexing is not supported for variables of this type" when using cell of doubles?

2 views (last 30 days)
Hi,
I have code I am trying to run which isnt working anymore. The original version is this:
for p = 1:length(file_list)
for c = 1:1
column_1 = cell2mat(basket_data{p,1}(:,c));
end
end
Running this with the cell of cells array basket_data worked fine.
Now I am using a cell of doubles array a_basket_h and it no longer works. I am unsure why however.
Here is the code:
for p = 1:length(file_list)
for c = 1:1
column_2 = cell2mat(a_basket_h{p,1}(:,c));
end
end
Am I incorrectly indexing the cell of doubles? What do I need to change?
Thank you!

Accepted Answer

Voss
Voss on 21 Mar 2022
Try removing cell2mat() in the second case:
for p = 1:length(file_list)
for c = 1:1
column_2 = a_basket_h{p,1}(:,c);
end
end

More Answers (0)

Categories

Find more on Cell Arrays 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!