table calculation for CSV file

조회 수: 2 (최근 30일)
kevin Lee
kevin Lee 2021년 1월 25일
댓글: dpb 2021년 1월 25일
first picture is table data that I have to use and I already import it in MATLAB
  1. 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?
  2. What code should I use to add all the valuse in column J? (denote as N)
  3. After I calculate N, I want to find percentage of each month like) 3J/N, 4J/N
  댓글 수: 4
dpb
dpb 2021년 1월 25일
"sorry for small image. "
So attach the table instead...with the paperclip. The expression should work as written.
dpb
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
Jeremy Hughes 2021년 1월 25일
  1. 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.

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by