Respondida
I'm trying to display pascals triangle but the higher numbers are messing up the formatting, any solutions?
You can specify some field widths in your fprintf calls. rows = 15; PT = zeros(rows); for c = 1:rows PT(c,1) = 1; f...

más de 3 años hace | 1

Respondida
Vectorize output of for loop, but using specific vector values
k=1.38E-23; E0= 2.72361635536024e-21 M=3; myVector = zeros(M+1,1); T = [100,300,1000,3000]; for ii = 1:numel(T) ...

más de 3 años hace | 0

| aceptada

Respondida
comparision of data with logic given as input
Assuming T1, ..., T10 are scalars, T = [T1 T2 T3 T4 T5 T6 T7 T8 T9 T10]; [~,idx] = max(T); I = zeros(size(T)); I(idx) = ...

más de 3 años hace | 0

| aceptada

Respondida
How to label the x axis in matlab for boxplot ?
xticklabels({'january','feb','mar'})

más de 3 años hace | 0

| aceptada

Respondida
combine cell data into column
M = vertcat(C{:}); where C is your cell array; M will be your big column vector.

más de 3 años hace | 0

| aceptada

Respondida
Changing numeric matrix name with the loaded file
[fn,pn] = uigetfile('*.mat','Select .mat File'); if isequal(fn,0) return % user closed dialog without selecting a file ...

más de 3 años hace | 0

Respondida
plot a graph from user input
Change this: plot(u,t) to this: plot(t,u)

más de 3 años hace | 0

Respondida
ASCII/HAMMING DECODER
It's been awhile since I studied error-correcting codes, but I believe that with this generator matrix: G = [1 0 0 0 1 1 0; ...

más de 3 años hace | 0

| aceptada

Respondida
How to plot histogram using given data ?
% Value first Second third M = [ ... 10 0.67 0.66 0.70; ... 20 0.38 0.37 0.42; ... 30 0.26 0.25 0...

más de 3 años hace | 0

| aceptada

Respondida
How to change a range of numbers in a matrix to a random number of a matrix?
G = reshape(1:125,[25,5]) x = setdiff(0:24, 2:25) idx = G >= 2 & G <= 25; G(idx) = x(randi(numel(x),[nnz(idx),1]))

más de 3 años hace | 0

| aceptada

Respondida
Parsing this line 'Step Information: Rload=100 R1=1 (Run: 2/18)'
Here's one way: % Example line to parse line = 'Step Information: Rload=100 R1=1 (Run: 2/18)'; % Parse the line using rege...

más de 3 años hace | 0

Respondida
Appdesigner get Index and String from DropDownMenu
If you need the index and the string, then the way you're doing it is good. If you just need the string, you should do away wit...

más de 3 años hace | 0

Respondida
How to plot a trajectory with varying colour?
"I'm trying to assign an independent variable to a data point in 2D through colour." You can choose any colour(s) you like. Ex...

más de 3 años hace | 0

| aceptada

Respondida
Develop a reordering matrix based on stored vectors
order_old = [1 2 3 4 5 6]; order_new = [4 5 1 2 3 6]; Output = order_old.' == order_new

más de 3 años hace | 0

| aceptada

Respondida
Retrieve App Designer textarea content along with the newline characters
The multi-line text is stored as a cell array of character vectors in the textarea's Value, so to present it with newlines, you ...

más de 3 años hace | 1

| aceptada

Respondida
Extracting Corresponding values from an array
Example usage, function defined below. matrix = [1 2; 3 4; 5 6; 1 8] get_2nd_column_val(matrix,3) get_2nd_column_val(matrix,1...

más de 3 años hace | 0

| aceptada

Respondida
Create function to convert data type as table: 2 errors
One problem appears to be that the function expects a table but you're giving it a categorical array. I can't say for sure becau...

más de 3 años hace | 1

| aceptada

Respondida
How to iterate through the struct char to label a new struct correctly?
for x = 1 : length(theFiles) baseFileName = theFiles(x).name; %e.g. for x =1 , baseFileName = 'sample_1.mat' [~,fn,~] ...

más de 3 años hace | 0

Respondida
Polyfit function is returning a partial line of best fit
Rather than calling plot with the fitobject returned from fit, you can use coeffvalues to get the coefficients of the fitobject ...

más de 3 años hace | 1

Respondida
ASCII TO HAMMING CODE 7.4
I would check that you're putting the elements of encodedMsg in the right order here: encodedMsgStr = num2str(encodedMsg(:).');...

más de 3 años hace | 0

| aceptada

Respondida
How do I create a loop to give me cut-off value
cutoff = 1500; vals = [200,450,950,1000,1200,1450,1550,1600,1650]; for ii = 1:numel(vals) if vals(ii) >= cutoff ...

más de 3 años hace | 1

| aceptada

Respondida
made up function not running in matlab, error: unrecognized function or variable. How can I get this fixed?
Looks like the first three lines: image1 = imread('ex.tif'); [avg_profile, radius] = radialProfile(image1, 12); plot(radius, ...

más de 3 años hace | 0

| aceptada

Respondida
how extract table RowNames based on table elements
% a table as you describe t = table([1;NaN;3;4;NaN],'RowNames',{'A';'B';'C';'D';'E'}) % extract RowNames of the NaN rows nan_...

más de 3 años hace | 0

| aceptada

Respondida
How to extract column index based on value in another column?
% first I create a table of random data n_rows = 15; data = zeros(n_rows,4); for ii = 1:n_rows data(ii,:) = randperm(4);...

más de 3 años hace | 0

Respondida
How to assign 0 or 1 randomly to the coordinates?
val = randi([0 1], size(X)) ;

más de 3 años hace | 0

Respondida
Load multiple files on MATLAB
n_files = 10; VACF_all = zeros(n_files,100); % Pre-allocate a matrix to store all the VACF results. ...

más de 3 años hace | 0

| aceptada

Respondida
Not able to combine data in cells of different sizes
Here's one way. The idea is to use NaNs to fill out the matrix you build. n_files = 30; n_c = 0; c = NaN(n_c, n_files); fo...

más de 3 años hace | 1

| aceptada

Respondida
Looping through sets of names for a match and selecting variable with this name
You're comparing a numeric index (xx), which is between 1 and length(accvectors_name), with a length-3 character vector (ID). In...

más de 3 años hace | 1

| aceptada

Respondida
How to eliminate a number of rows at certain points of a large data set?
If rawdata is your matrix: % number of rows in your matrix: N_rows = size(rawdata,1); % construct a logical vector of 500 t...

más de 3 años hace | 1

| aceptada

Respondida
How can I plot contour lines on the generated map?
In your code, you make the map then create a new figure for each contour. Those new figures aren't going to have the map; the ma...

más de 3 años hace | 0

| aceptada

Cargar más