how to solve this error
1 次查看(过去 30 天)
显示 更早的评论
Redflower
2019-2-24
I got this error Subscript indices must either be real positive integer or logical
I am tried to removed the range of desired signal from dataset matrix and find the power of that range. then the remaining will be interferance and also i want to find the power of remaining range
the error occured when i want to find the power of interferance
PI=mean(mean(SysSetup.Dataset(:,RI).^2))
this is my code
25 个评论
Geoff Hayes
2019-2-24
Redflower - so the code is failing at the 7th or 8th line? What can you tell us about RI? i.e. what are the values of this array? Are they positive integers or (as the error message suggests) something else?
Walter Roberson
2019-2-24
When you use linspace() you should assume that you are going to get back values that are not necesarily positive integers. If you need positive integers, it is safer to use the colon operator, probably in conjunction with floor() or ceil().
Perhaps in your case it would be sufficient to index at round(RI) instead of at RI .
Redflower
2019-2-25
dear Goff
the error in line 10 and the matlab file which i use to find the result
a![error.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205726/image.png)
![error.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205726/image.png)
Walter Roberson
2019-2-25
You attach code but not sysSetup or the other variables needed for us to run the code to test.
Walter Roberson
2019-2-25
It looks like it is necessary to call
ModDatasetGenpaper; %to define SysSetup
Train_cumulantpaper; %to define net
something unknown at this point %to define ModIdentdataset
AccuVsSIR2cum; %to do computation
Unfortunately without the code to define ModIdentdataset it is difficult for us to test.
Redflower
2019-2-25
what you are saying correct
i attached again the all codes. and let me to know if they work
Walter Roberson
2019-2-25
Okay, finally I can reproduce your error.
You copy the test dataset into RI and you delete the columns given by Rd (a list of positive integers) from that. The result is a 2D numeric array of floating point data with fewer columns that the test dataset.
You then try to index sysSetup.Dataset() using that floating point dataset as indices.
I suspect you want to instead take
RI = setdiff(1:size(Dataset_test,2), Rd);
That is, I suspect you want RI to be the list of remaining indices.
Redflower
2019-2-26
the code you give is work but again matlab give me an error on line 16
matrix dimensions must be agree
Walter Roberson
2019-2-26
Ah, yes, if RI is not the same length as Rd then line 16 would trigger an error.
I cannot suggest any solution due to the lack of documentation about what Rd and RI are intended to represent.
Walter Roberson
2019-3-3
I do not know. If I had documentation about what Rd and RI should mean, then I might be able to assist.
Redflower
2019-3-4
I work on digital modulation classification. I have seven classes each class has 1000 signal. at training phase, I use dataset of 7000 signals to built classifier (these signals without any effect of noise). at testing phase i want to test the classifier when there is interference.Also, i use dataset of 7000 signals.
for more details:
class Range
class 1 ( 2-ASK 1- 1000)
class2 (4-ASK 1001-2000)
class3 (2-PSK 2001-3000)
class4 (4-PSK 3001-4000)
class5 (8-PSK 4001-5000)
class6 (16-QAM 5001-6000)
class7 (64-QAM 6001-7000)
my task is to find the accuracy of classifier ( when only one class is desired and other will be interference)
Rd present the desired class
RI present the interference classes
Each time I must find the accuracy of desired class vs interference classes at different SIR value ( signal to interference ratio)
Redflower
2019-3-4
yes, that is previous version of code in that cade i find the accuracy of classifier ( when only one class is desired and one class is interfered)
now i want to find the accuracy of classifer when (one class is desired and others will be interference) but I don't know how to modify the code
Walter Roberson
2019-3-4
It is a little after 1 AM where I am. I could go back to examine your code and predict what bugs you might have introduced when you made unknown changes to your code, and then tell you how to correct each of the possibilities... or I could go to bed and check in the morning to see whether you posted your updated code.
Redflower
2019-3-5
i tried this code and the remaining code still same
but it give me an error in line 16
Redflower
2019-3-5
i tried this code and the remaining code still same
but it give me an error in line 16
Redflower
2019-3-5
I tried to to takes more than one class as interference at computation code AccVsSIR2cum ONLY change in
Acc(n)= Test_cumulantpaper(net, SysSetup, 1, [2 6],0)
where 1 is desired class
and 2 and 6 is interference class
Walter Roberson
2019-3-5
What do you think the result from that linspace() shoud be?
Are you expecting a series of consecutive integers? Are you expecting a series of integers with a constant gap between them? Are you trying to "sample" a range of integers at as close as you can get to equal partitions? Are you trying to extract the index numbers of all samples belonging to a particular class when the SysSetup information knows where the class starts and how long it is?
Redflower
2019-3-5
I tried to to extract all sample belonging to particular class when the SysSetup information knows where the class start
for example if i select 2 and 6 [ 2 6]
i expect to take all samples of class 2 from 1001- 2000 and 5001-6000 and put them in one matrix
same if i select 1, 2 ,4 [1 2 4]
i expect to take all sample of class 1 from 1-1000 , 1001-2000 for class 2 and 3001-4000 for class 4 and put all of them in one matrix
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)