Answered
how can i transfor these numbers into dates (dd / mm/ yyyy) in Matlab? 19300501 19300502 19300503 19300505
Using datetime: >> M = [19300501;19300502;19300503;19300505] M = 19300501 19300502 19300503 19300505 >> D...

7 years ago | 1

| accepted

Answered
X = [struct(jjj).name,' seed ', seedno]; disp(X) is not printing seedno
X = [struct(jjj).name,' seed ',num2str(seedno)]; disp(X) Or using low-level commands: fprintf('%s seed %d\n',struct(jjj).name...

7 years ago | 1

| accepted

Answered
How to replace strings in a cell array
>> C = {'A', 'B', 'C', 'D', 'QQQQ_01', 'E', 'QQQQ_02'} >> X = find(strncmp(C,'QQQQ',4)); >> C(X) = strcat('Q_',C(X-1)) C = ...

7 years ago | 0

| accepted

Answered
Writting a loop for calculating difference from previous result of first calculation
Initial_value = 50; minimum_value = 25; difference_value = 5; remaining_value = Initial_value; while remaining_valu...

7 years ago | 0

| accepted

Answered
How can I pass in variables into fsolve()?
"...can't seem to figure out how to pass in the known variables of A to this section of code:" The MATLAB documentation explain...

7 years ago | 0

| accepted

Answered
I have a matrix with one column in serial datenumber format, how do I select data from a certain time period?
Serial date numbers are, as their name implies, just numbers. So it is very easy to use logical comparisons, just like you would...

7 years ago | 0

| accepted

Answered
fixing an error for calling a variable in an array
I suspect that you want something like this: >> Y = [1,7;3,9;11,12;15,18;22,12;12,23;15,19;10,22;17,28;111,123] Y = 1 ...

7 years ago | 0

| accepted

Answered
How to pass arguments into a function handle that is then used in fsolve?
function out = transcendental(neff,w) % best to use same name as the file. % Do NOT define |w| here! c = 2.998e8; ns = 1.5; ...

7 years ago | 0

| accepted

Answered
how to select a set which has a highest value when compared with other sets
>> Z = {[23,45,67,89,36],[32,56,44,47,33,66],[12,45,76,99,50,76],[19,67,89,37,19,36]}; >> [~,X] = max(cellfun(@max,Z)); >> V =...

7 years ago | 0

Answered
How to check ismember in a cell in Matlab?
>> List = {[4,5,2],[27,19],[13,8],[17,14],[3,13],[21,20],[6,16],[4,30],[1,13],[20,2],[14,27,2];[5,2],[21,7],[29,6],[17,36],[35,1...

7 years ago | 0

| accepted

Answered
Extracting values from file names to array
>> D = 'path to the folder where the files are saved'; >> S = dir(fullfile(D,'file_*.txt')); Method one: regexp: >> V = str2d...

7 years ago | 2

| accepted

Answered
Cell array indexing in loop for subplot titles
You defined a variable named title: title={'# objects','centroid mean','centroid mode','FM','Q99'} which shadows the title fun...

7 years ago | 1

| accepted

Answered
Varargout - How to realize function call
Simpler: function [out1,out2,out3]=test(j,k) out1= nargin; out2 = j-k; out3 = []; ... if out2 == 10 out3 = 5; end e...

7 years ago | 0

| accepted

Answered
Uploading a value with a Matrix into MATLAB GUI
Clearly tempval is a cell array, which as the error message makes quite clear, sprintf cannot handle. But regardless, that is a ...

7 years ago | 1

| accepted

Answered
How do i assigning a color to a range of numbers in an image array?
A = [9899,9899,9899,9899,9899;9899,-90,0,70,9899;9899,9899,-20,30,9899;9899,9899,9899,9899,9899]; % backgnd; neg; zero; po...

7 years ago | 0

| accepted

Answered
Retrieve a vector from a field of a structure with certain length
>> Problem.phases(1).path.nonLinear(1).buffer.include = 1; >> Problem.phases(1).path.nonLinear(2).buffer.include = 0; Method o...

7 years ago | 0

Answered
How can I change where a variable is placed within the field width using fprintf?
By default the text will be right-justified within the field. The fprintf documentation states that you can left-justify using ...

7 years ago | 0

Answered
How to change one line of code?
function y = myfun(x) y = sum(x.^2); end Or if you really only want to sum the first three elements: function y = myfun(x) ...

7 years ago | 0

| accepted

Answered
what's the meaning of a number divide column vertor?
"what's the meaning of a number divide column vertor?" The mrdivide documentation explains at the top of the page that it will ...

7 years ago | 0

| accepted

Answered
Saving and uploading data with any file name
"...on how I can fix this" That is easy: fix your save syntax. You seem to have confused high-level file importing/exporting f...

7 years ago | 0

| accepted

Answered
Fill NaN matrix with vector of unequal sizes
CMC_RT(k).RF.GyrNorm(1:10,1) = CMC_RTT.RF.(temp{a})(k,1:10); CMC_RT(k).RF.GyrNorm(1:9,2) = CMC_RTT.RF.(temp{a})(k,11:19); The...

7 years ago | 0

| accepted

Answered
Assign values to a string in Matlab
>> X = 'abcaaabc'; >> Y = num2cell(X) Y = 'a' 'b' 'c' 'a' 'a' 'a' 'b' 'c' >> Y1 = X-97 Y1 = ...

7 years ago | 0

Answered
Figures not saving as specific file type regardless of specified extension
Specifying the image file type and specfiying the file extension are two totally different things. Your title "Figures not savin...

7 years ago | 1

| accepted

Answered
regexprep does not exactly what I want
>> regexprep(Charge,'^[^-+]*','') ans = '-1' '+0' '+1' '-1' '+0' '+1' >> regexp(Charge,'[-+].+$','once','...

7 years ago | 1

Answered
What are variable scopes?
Consider that inside some function you define some variable, e.g.: X = 3; You might then ask yourself, now that I have defined...

7 years ago | 0

| accepted

Answered
Count the values inside a cell array considering another cell array
>> Rc = vertcat(R{:}); >> Vc = vertcat(V{:}); >> X = ~cellfun('isempty',Rc) & ~cellfun('isempty',Vc); >> F = @(r,v) sum(r(2,v...

7 years ago | 0

| accepted

Answered
Saving the values into a mat file error
Rather than this indirect, complex, buggy, obfuscated, strongly inadvisable code: evalstring = sprintf('handles.mystructdata.%s...

7 years ago | 0

| accepted

Answered
de2bi not working for large decimal number
"Why is that?" Because those functions use double class, and your value is well above flintmax: >> 2^53 % flintmax ans = 9.00...

7 years ago | 0

| accepted

Answered
Count how many element are inside each cell af a cell array on the basis of an array
>> C = vertcat(V{:}); >> X = ~cellfun('isempty',C); >> F = @(x)sum(x(2,:)<=80); >> M = zeros(size(C)); >> M(X) = cellfun(F,C...

7 years ago | 0

| accepted

Answered
How to subtract two close numbers?
"..i don't know why it doesn't give exact zero." The decimal values 5.4 and 0.4 cannot be represented exactly using binary floa...

7 years ago | 1

| accepted

Load more