table calculation for CSV file
1 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/499563/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/499583/image.png)
first picture is table data that I have to use and I already import it in MATLAB
- I tried readtable('CSVCWtable3') but MATLAB said Unable to find or open 'CSVCWtable3'. Check the path and filename or file permissions. how can I fix it?
- What code should I use to add all the valuse in column J? (denote as N)
- After I calculate N, I want to find percentage of each month like) 3J/N, 4J/N
4 个评论
dpb
2021-1-25
"sorry for small image. "
So attach the table instead...with the paperclip. The expression should work as written.
dpb
2021-1-25
Not an image, no. save the variable to a .mat file and attach that; we can do nothing with images except look at them.
But, from a sample table left in the workspace here from a previous answer we can illustrate that the syntax works...
>> tmp
tmp =
8×3 table
Mean MeanVals MeanUnits
_____________ _________ _________
{'200.80 V' } 200.8 V
{'22.613 mV'} 0.022613 mV
{'200.99 V' } 200.99 V
{'3.7514 ms'} 0.0037514 ms
{'25.886 ms'} 0.025886 ms
{'22.987 mV'} 0.022987 mV
{'147.81 mV'} 0.14781 mV
{'1.4309 mV'} 0.0014309 mV
>> tmp{:,2:end-1}./sum(tmp{:,2})
ans =
0.4995
0.0001
0.5000
0.0000
0.0001
0.0001
0.0004
0.0000
>>
Only had one numeric column left instead of multiples, but the tmp{:,2:end-1} syntax with end keywork worked to return the second column.
回答(1 个)
Jeremy Hughes
2021-1-25
- I tried readtable('CSVCWtable3') but MATLAB said Unable to find or open 'CSVCWtable3'. Check the path and filename or file permissions. how can I fix it?
If the file is not in the PWD, you should supply the path and the extension.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!