table calculation for CSV file

4 visualizzazioni (ultimi 30 giorni)
kevin Lee
kevin Lee il 25 Gen 2021
Commentato: dpb il 25 Gen 2021
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 Commenti
dpb
dpb il 25 Gen 2021
"sorry for small image. "
So attach the table instead...with the paperclip. The expression should work as written.
dpb
dpb il 25 Gen 2021
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.

Accedi per commentare.

Risposte (1)

Jeremy Hughes
Jeremy Hughes il 25 Gen 2021
  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.

Categorie

Scopri di più su Tables in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by