num2str use for a product of two queried variables
1 view (last 30 days)
Show older comments
With a for loop, num2str works fine querrying a single variable array:
for i = 1:runs
a = num2str(data.x(i));
end
But when I try to use as I needed, i.e. multiply data.x with data.y:
for i = 1:runs
a = numstr(data.x.*data.y(i));
end
I get this error:
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Note: data.x and data.y are both arrays of size 10x1; and the product of the two is only allowed along this "a" line.
Thanks for any tip on this!
1 Comment
Matt J
on 20 Apr 2022
COpy/paste the full errror message and, ideally, post enough code that we can run and reproduce the error.
See Also
Categories
Find more on Logical 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!