How to remove everything from string except what's inside square brackets?
8 views (last 30 days)
Show older comments
I have this cell array:
{'0,11:1.03 SPEED MEASURED 1 [rpm]'}
{'0,12:1.03 SPEED MEASURED 1 [rpm]'}
{'0,13:1.03 SPEED MEASURED 1 [rpm]'}
{'0,14:1.03 SPEED MEASURED 1 [rpm]'}
{'0,11:1.06 MOTOR CURRENT [A]' }
{'0,12:1.06 MOTOR CURRENT [A]' }
{'0,13:1.06 MOTOR CURRENT [A]' }
{'0,14:1.06 MOTOR CURRENT [A]' }
{'0,11:2.13 TORQ USED REF [%]' }
{'0,12:2.13 TORQ USED REF [%]' }
{'0,13:2.13 TORQ USED REF [%]' }
{'0,14:2.13 TORQ USED REF [%]' }
{'0,11:1.08 MOTOR TORQUE [%]' }
{'0,12:1.08 MOTOR TORQUE [%]' }
{'0,13:1.08 MOTOR TORQUE [%]' }
{'0,14:1.08 MOTOR TORQUE [%]' }
{'0,11:2.10 TORQUE REF 3 [%]' }
{'0,12:2.10 TORQUE REF 3 [%]' }
{'0,13:2.10 TORQUE REF 3 [%]' }
{'0,14:2.10 TORQUE REF 3 [%]' }
How can I get the unit from between the brackets in each string, so that I'm left with the following:
{'rpm'}
{'rpm'}
{'rpm'}
{'rpm'}
{'A' }
{'A' }
...
{'%' }
Thanks!
6 Comments
See Also
Categories
Find more on Motor Drives 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!