Using num2str to get brackets
Show older comments
Hi,
from
A = [ 54,0.04; 60,0.03; 65,0.02; 67,0.01];
I want to get:
B = [(54,0.04);(60,0.03);(65,0.02),(67,0.01)];
Which I will use to display in a plot. The problem is I can get the comma in the middle using num2str but not the brackets on either side.
I have tried:
for j = 1:size(A,1)
B(j) = ['[',num2str(A(:,1),'%5.3g),']'];
end
But I get a dimension error. Not sure what to try next.
Any help will be great. Thanks
Accepted Answer
More Answers (1)
Amandeep
on 11 Sep 2011
Categories
Find more on Interactive Control and Callbacks 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!