Respondida
Replace values in a 3D array, from a condition in a 2D array
% create a 151x432 matrix of random numbers: z = rand(151,432); % make 10000 of the elements 0: z(randi(151*432,1,10000)) = 0...

más de 4 años hace | 1

| aceptada

Respondida
Sprintf is adding one from categorical data
Try using '%s', rather than '%i' or '%d', in sprintf: c = categorical([1 4 9 16]); sprintf('digit %i, ',c) sprintf('digit %...

más de 4 años hace | 0

| aceptada

Respondida
Array indices must be positive integers or logical values
Do you have variables called log or logninv? If so, MATLAB will treat, e.g., log(Tb) as taking element(s) at index Tb in the ar...

más de 4 años hace | 0

Respondida
Unrecognized function or variable 'boxplotGroup'
boxplotGroup is a function from the File Exchange, so you'd have to download it from there: https://www.mathworks.com/matlabcen...

más de 4 años hace | 1

| aceptada

Respondida
How do I use the for loop to replace elements in an array?
array = randi(7,1,20); disp(array); % use a for loop to replace all the 4's in array with 19's: for ii = 1:numel(array) ...

más de 4 años hace | 0

Respondida
How to randomly present images
% use your folder's path, and use your file type (.png, .jpg, whatever): % img_files = dir(fullfile('C:\Users\ja-woo\Desktop\ha...

más de 4 años hace | 1

| aceptada

Respondida
Nested loops for double summation
total = 0; for i = 1:10 for j = 5:20 total = total + i + j; end end

más de 4 años hace | 1

Respondida
Syntax error for Calcium imaging analyses code: I am trying to implement Ca2+ analyses pipeline but there is a following syntax error:
Define the function like this: function [ROI_intensity1, c, r] = GCamp6(time_interval, timelapse_file, legend_name, neuron_diam...

más de 4 años hace | 1

Respondida
how to take an alternating range of elements from a vector to make two new vectors
a = [ 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 ...

más de 4 años hace | 0

| aceptada

Respondida
how to multiply every element in an array?
o = [3 1 9]; % no for loop: p = prod(o); disp(p); % some for loop: p = 1; for ii = 1:numel(o) p = p*o(ii); end ...

más de 4 años hace | 1

| aceptada

Respondida
how to solv this issue?
The error happens on this line: temp5=T2(i,5); and is caused by attempting to access an element in column 5 of T2 but T2 has o...

más de 4 años hace | 0

| aceptada

Respondida
Using Solve function in a for loop
The problem is that solve returns two solutions and you want to store them in a single element of out. Instead of doing that, yo...

más de 4 años hace | 0

| aceptada

Respondida
Function Handle for a Rectangular Function
% rect = @(t)double(0<=t & t<=1); % returns double array (1/0) rect = @(t)0<=t & t<=1; % returns logical array (true/false) ...

más de 4 años hace | 0

| aceptada

Respondida
merge three barh (stacked)
Is this what you have in mind? (For each variable A through V, one bar with the sum of columns B - K (always 10 in this file), ...

más de 4 años hace | 1

| aceptada

Respondida
generate random number between positive and negative and sum of this number is zero
x = randn(); % random number from standard Normal distribution y = -x; % another number such that the sum of x and y is 0 ...

más de 4 años hace | 0

Respondida
The problem shows the error of nonconformant arguments or syntax error
I don't get any errors running the code you show, but maybe you mean to use element-wise division ( ./ ) in calculating CD p = ...

más de 4 años hace | 0

Respondida
How to make my output display in static box(GUI)
% First, create your static text box somewhere: t = uicontrol('Style','text'); % Later, when you have something to show in i...

más de 4 años hace | 0

Respondida
How to plot this equation?
Here's how you might calculate and plot some similar curves. You can take the syntax and apply it to yours. L = 10; x = -1000:...

más de 4 años hace | 0

| aceptada

Respondida
How can I plot with a for data named h1-h10?
Looks like you might have x1, x2, ..., x10 as well. If not, you can modify this accordingly. h_all = {h1 h2 h3 h4 h5 h6 h7 h8 h...

más de 4 años hace | 0

| aceptada

Respondida
How to split each element in a cell array into four equal parts?
Use curly braces {} to access the vectors in the individual cells of splitBinaryUserMessage: % userMessage = input('Please inpu...

más de 4 años hace | 0

| aceptada

Respondida
Warning: The assignment added rows to the table, but did not assign values to all of the table's existing
The warning happens because the table Betas gets a new row added each time the j loop runs its first iteration (except when i i...

más de 4 años hace | 0

| aceptada

Respondida
Not enough input arguments when they are already defined
Your function theiss calls itself with one input; that's the reason for the error. function [ux] = theiss(r,S,T,t) % theiss ca...

más de 4 años hace | 0

| aceptada

Respondida
Different variable multiplication for different columns in a MATRIX
A = randi(10,[6 10]) % one way: factor = [2*ones(1,5) 3*ones(1,5)] B = A.*factor % another way: factor = repelem([2 3],1,5)...

más de 4 años hace | 0

Respondida
NEED HELP! I'm trying to Create a plot in MATLAB App Designer that uses a variable (for the x-axis) that goes up in real time in seconds....
I'm not sure what the intent is with this line: t= app.StartButtonPushed(); but I suspect that's where the error is ha...

más de 4 años hace | 0

Respondida
How do I take the average of elements that are within a range?
A = [320 315 850 325 390 10000 900]; B = []; is_close = abs(A-A.') <= 100; is_counted = false(1,numel(A)); while any(~is_c...

más de 4 años hace | 0

| aceptada

Respondida
How to read excel data in app designer?
function ButtonPushed(app, event) t = readtable("Kitap1.xlsx","Sheet",1); app.UITable.Data = t; app.UITable.Colum...

más de 4 años hace | 0

| aceptada

Respondida
How to change x-axis ticks labels in stackedplot?
There does not seem to be an easy way to set the XTick or XTickLabel of a StackedLineChart object (such as what's created by sta...

más de 4 años hace | 1

| aceptada

Respondida
fonksiyonun bir önceki değerini hafızada tutması
Existing code, for reference: v=10;l=0.1;r=10;i0=0;t0=0;h=0.001; for i=0:1 i1=i0+h*(100*(1-i0)); end fprintf('i1= %f \n',i1...

más de 4 años hace | 0

Respondida
Function not giving an output
function y = Parking_Bill(pt,time) % if (pt == (1 || 2) && (size(time) == 4)) if (pt == 1 || pt == 2) && numel(time) == 4 ...

más de 4 años hace | 0

| aceptada

Respondida
Selecting .tif files from a folder and copy them to another folder
clear all; close all; clc; HOME = '/Users/aahmed78/PhD/Data/SWOT/May2015'; foldername = 'All_tif_images'; foldername = fullfi...

más de 4 años hace | 1

| aceptada

Cargar más