MATLAB: How to replace [ ] in an array with 0’s arrayemptyzero How can i replace the [] in the pathrisk field with 0's? Thanks for your help! Best Answer for i = 1:length(pathrisk) if isempty(pathrisk(i)) pathrisk(i) = 0; endend Related SolutionsMATLAB: Replace Cell Array with other Cell Array a1 = { 'i', 'love', 'you', 'you', 'love'; 'i', 'you', 'love', 'i', 'much'}a2 = { [], [], [], 'so', 'much'; [], 'love', 'you', 'so', []}idx=cellfun(@isempty,a2) a2(idx)=a1(idx) MATLAB: Replace [ ] in an array with 0’s tables use functions like ismissing() and fillmissing():newTable = fillmissing(badTable, 'constant', 0) Related QuestionHow to count the number of empty cells in an arrayAutofilling a matrix with 0’sHow to count the 1X1 cells in a cell arrayAssigning a value to 0’sGetting rid of empty cells in a cell array
Best Answer