Index in position 1 exceeds array bounds (must not exceed 1).

1 view (last 30 days)
Index in position 1 exceeds array bounds (must not exceed 1).
Error in jsondecode_v1 (line 257)
text(total_cellcount.time(find(isinf(ratio_mig_rim_cor))),(max(ratio_mig_rim_cor(~isinf(ratio_mig_rim_cor))-1)),'0
cell in core')
I tried running these:
>> total_cellcount.time(find(isinf(ratio_mig_rim_cor)))
>> max(ratio_mig_rim_cor(~isinf(ratio_mig_rim_cor))-1))
and each return one value.
I am trying to add a text at specific location in a figure and I get above error. Any suggestion?
Update:
I tried this: text(2,2,'0 cell in core')
I just gave static positions and I got the same error.
Index in position 1 exceeds array bounds (must not exceed 1).
Error in jsondecode_v1 (line 257)
text(2,2,'0 cell in core')
  7 Comments
Walter Roberson
Walter Roberson on 3 Sep 2019
You created a vector named text instead of text being the name of a MATLAB plotting call.
Zeynab Mousavikhamene
Zeynab Mousavikhamene on 3 Sep 2019
Great point @walter. I am not sure how I can press "accepted answer".

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 3 Sep 2019
Edited: Walter Roberson on 3 Sep 2019
You created a row vector named text instead of text being the name of a MATLAB plotting call.
... and then you access that row vector as if it were a 3D array, which is why you get the indexing error.

More Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 3 Sep 2019
Hi,
In your command to display the string: '0 cell in core'
One of your set logical indexes ( total_cellcount.time(find(isinf(ratio_mig_rim_cor))), (max(ratio_mig_rim_cor(~isinf(ratio_mig_rim_cor))-1))) has more than one value.
You can check this issue by running these commands:
>> total_cellcount.time(find(isinf(ratio_mig_rim_cor)))
>> max(ratio_mig_rim_cor(~isinf(ratio_mig_rim_cor))-1))
These should show how many values are obtained from each of your assigned x and y for your string display position.
Good luck.

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!