Index in position 1 is invalid. Array indices must be positive integers or logical values. Z=null(R,'r')

1 view (last 30 days)
I got a problem with this code. Appearently it works for my friends (even if i copy their assignment, that works, and paste it my computer still says that there is an error). Do any of you know how to fix this problem?
% Assignment 2.6
% An acidic aqueous solution contains Cr_2O_3, Cr^3+, Cr(H_2O)_6^3+,[Cr(H_2O)_5(OH)]^2+, H^+ and H_2O
% Determine the number of independent chemical reactions and use matrix algebra to suggest stoichiometric coeffcients for these reactions.
R=[2 1 1 1 0 0;3 0 6 6 0 1;0 0 12 11 1 2;0 3 3 2 1 0]
Z=null(R,'r')
  1 Comment
Bruno Luong
Bruno Luong on 10 Sep 2019
Edited: Bruno Luong on 10 Sep 2019
You overshadow MATLAB function NULL.
Type
which null
Check if it returns path of MATLAB stock function, something ike this
C:\Program Files\MATLAB\R2019a\toolbox\matlab\matfun\null.m

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 10 Sep 2019
Edited: madhan ravi on 10 Sep 2019
This is the exact reason why people shouldn’t name variables as the names of inbuilt functions!!
clear null % to clear the variable named null in workspace

More Answers (0)

Community Treasure Hunt

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

Start Hunting!