MATLAB code to find the frequency of each element in some alloys
2 次查看(过去 30 天)
显示 更早的评论
I need a MATLAB code to find the frequency of each element in some alloys that are the input file:
The input:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/357322/image.jpeg)
The output:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/357325/image.jpeg)
Best
M. Vaghari
3 个评论
John D'Errico
2020-9-7
Since this is likely homework, what have you tried? If nothing, why not? In that case, you just need to start learning MATLAB. So make an effort. Show you are trying, and what you tried. You will likely gain some help then.
采纳的回答
Rik
2020-9-7
You can you the histogram related function histcounts to count occurences. You just need to split the alloy name in the constituent elements, which should be easy, because each upper case letter is a new element. The best tool to use is probably regexp with the split option.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Data Preparation 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!